From 9843cf6e0c1eabb20f27f143cdc5cc6a7d721c71 Mon Sep 17 00:00:00 2001 From: Nigel Date: Thu, 4 Apr 2024 22:39:20 +0200 Subject: [PATCH] FEAT: Adding Codellama as a nvim plugin using gen.nvim --- lazy-lock.json | 1 + lua/barink/keys.lua | 1 + lua/barink/plugins/codellama.lua | 17 +++++++++++++++++ 3 files changed, 19 insertions(+) create mode 100644 lua/barink/plugins/codellama.lua diff --git a/lazy-lock.json b/lazy-lock.json index e2e2465..395169c 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -5,6 +5,7 @@ "cmp-nvim-lsp": { "branch": "main", "commit": "5af77f54de1b16c34b23cba810150689a3a90312" }, "cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" }, "fidget.nvim": { "branch": "main", "commit": "933db4596e4bab1b09b6d48a10e21819e4cc458f" }, + "gen.nvim": { "branch": "main", "commit": "87fbe811155b90eea58622614809705b966009ad" }, "hardtime.nvim": { "branch": "main", "commit": "21b0f9146198bb43fbc9f5ec66c8af3234f278ed" }, "harpoon": { "branch": "harpoon2", "commit": "a38be6e0dd4c6db66997deab71fc4453ace97f9c" }, "lazy.nvim": { "branch": "main", "commit": "3132d7d27d56d6bb4bdd0a09623d162b3cf1c588" }, diff --git a/lua/barink/keys.lua b/lua/barink/keys.lua index fd06752..7579ba8 100644 --- a/lua/barink/keys.lua +++ b/lua/barink/keys.lua @@ -39,3 +39,4 @@ vim.keymap.set('n', '', function () print("Start debug session" ) require('d vim.keymap.set('n', '', function () require('dap').step_over() end ) vim.keymap.set('n', '', function () require('dap').step_into() end ) +vim.keymap.set('n', '=',":Gen Generate") diff --git a/lua/barink/plugins/codellama.lua b/lua/barink/plugins/codellama.lua new file mode 100644 index 0000000..e4987cd --- /dev/null +++ b/lua/barink/plugins/codellama.lua @@ -0,0 +1,17 @@ +return { + { + 'David-kunz/gen.nvim', + opts = { + model = "codellama:7b", + host = "localhost", + port = "11434", + quit_mape = "q", + init = function (options) pcall(io.popen("ollama serve > /dev/null 2>&1 &)")) end, + display_mode = "split", + command =function (options) + local body = {model = options.model, stream=true} + return "curl --silent --no-buffer -X POST http://" .. options.host .. ':' .. options.port .. "/api/chat -d $body" + end, + }, + } +}