feat(nvim): add gen.nvim extra

This commit is contained in:
Sergio Laín 2024-01-15 11:40:08 +01:00
parent 336245d67c
commit 6dfeeb0d01
No known key found for this signature in database
GPG key ID: 14C9B8080681777B
2 changed files with 30 additions and 0 deletions

View file

@ -46,6 +46,7 @@
- [tzachar/cmp-tabnine](https://github.com/tzachar/cmp-tabnine)
- [jackMort/ChatGPT.nvim](https://dotfyle.com/plugins/jackMort/ChatGPT.nvim)
- [zbirenbaum/copilot.lua](https://dotfyle.com/plugins/zbirenbaum/copilot.lua)
- [David-Kunz/gen.nvim](https://dotfyle.com/plugins/David-Kunz/gen.nvim)
</details>

View file

@ -0,0 +1,29 @@
return {
"jellydn/gen.nvim",
opts = {
model = "codellama",
display_mode = "split",
show_prompt = true,
show_model = true,
no_auto_close = false,
init = function(options)
pcall(io.popen, "ollama serve > /dev/null 2>&1 &")
end,
command = "curl --silent --no-buffer -X POST http://localhost:11434/api/generate -d $body",
},
config = function(_, opts)
local gen = require("gen")
gen.setup(opts)
gen.prompts["Elaborate_Text"] = {
prompt = "Elaborate the following text:\n$text",
}
gen.prompts["Fix_Code"] = {
prompt = "Fix the following code. Only output the result in format ```$filetype\n...\n```:\n```$filetype\n$text\n```",
extract = "```$filetype\n(.-)```",
}
end,
keys = {
{ "<leader>i", "<cmd>Gen<cr>", mode = { "n", "v" }, desc = "IA (Gen)" },
},
}