add gen.nvim #7
2 changed files with 50 additions and 0 deletions
48
lua/plugins/gen.lua
Normal file
48
lua/plugins/gen.lua
Normal file
|
@ -0,0 +1,48 @@
|
|||
return {
|
||||
"David-Kunz/gen.nvim",
|
||||
lazy = false,
|
||||
keys = {
|
||||
{ "<leader>ai", ":Gen<CR>", mode = { "n", "v" }, desc = "AI tools using Ollama" },
|
||||
{ "<leader>aa", ":Gen Ask<CR>", mode = { "n", "v" }, desc = "[A]I [A]sk" },
|
||||
{
|
||||
"<leader>am",
|
||||
function()
|
||||
require("gen").select_model()
|
||||
end,
|
||||
mode = { "n", "v" },
|
||||
desc = "Select [A]I [m]odel",
|
||||
},
|
||||
},
|
||||
config = function()
|
||||
require("gen").setup({
|
||||
ollama = {
|
||||
model = "codellama",
|
||||
host = "localhost",
|
||||
port = "11434",
|
||||
quit_map = "q",
|
||||
retry_map = "<c-r>",
|
||||
init = function(options)
|
||||
pcall(io.popen, "ollama serve > /dev/null 2>&1 &")
|
||||
end,
|
||||
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,
|
||||
display_mode = "split", -- "split" or "float"
|
||||
show_prompt = true,
|
||||
show_model = true,
|
||||
no_auto_close = false,
|
||||
debug = false,
|
||||
},
|
||||
})
|
||||
require("gen").prompts["Fix_Code"] = {
|
||||
prompt = "Fix the following code. Only ouput the result in format ```$filetype\n...\n```:\n```$filetype\n$text\n```",
|
||||
replace = true,
|
||||
extract = "```$filetype\n(.-)```",
|
||||
}
|
||||
end,
|
||||
}
|
|
@ -5,6 +5,7 @@ return {
|
|||
"nvim-lua/plenary.nvim",
|
||||
{ "nvim-telescope/telescope-fzf-native.nvim", build = "make" },
|
||||
"debugloop/telescope-undo.nvim",
|
||||
"nvim-telescope/telescope-ui-select.nvim",
|
||||
},
|
||||
config = function()
|
||||
require("telescope").setup({
|
||||
|
@ -21,6 +22,7 @@ return {
|
|||
-- Enable telescope fzf native, if installed
|
||||
pcall(require("telescope").load_extension, "fzf")
|
||||
pcall(require("telescope").load_extension, "scaladex")
|
||||
pcall(require("telescope").load_extension, "ui-select")
|
||||
pcall(require("telescope").load_extension, "undo")
|
||||
|
||||
-- See `:help telescope.builtin`
|
||||
|
|
Loading…
Reference in a new issue