mirror of
https://github.com/DefectingCat/nvim
synced 2025-07-15 16:51:33 +00:00
add gen plugin
This commit is contained in:
@ -182,6 +182,35 @@ local plugins = {
|
||||
vim.cmd([[silent! GoInstallDeps]])
|
||||
end,
|
||||
},
|
||||
{
|
||||
"David-Kunz/gen.nvim",
|
||||
event = "BufReadPost",
|
||||
opts = {
|
||||
model = "deepseek-coder", -- The default model to use.
|
||||
quit_map = "q", -- set keymap for close the response window
|
||||
retry_map = "<c-r>", -- set keymap to re-send the current prompt
|
||||
accept_map = "<c-cr>", -- set keymap to replace the previous selection with the last result
|
||||
host = "localhost", -- The host running the Ollama service.
|
||||
port = "11434", -- The port on which the Ollama service is listening.
|
||||
display_mode = "split", -- The display mode. Can be "float" or "split" or "horizontal-split".
|
||||
show_prompt = false, -- Shows the prompt submitted to Ollama.
|
||||
show_model = false, -- Displays which model you are using at the beginning of your chat session.
|
||||
no_auto_close = false, -- Never closes the window automatically.
|
||||
hidden = false, -- Hide the generation window (if true, will implicitly set `prompt.replace = true`)
|
||||
init = function(options) pcall(io.popen, "ollama serve > /dev/null 2>&1 &") end,
|
||||
-- Function to initialize Ollama
|
||||
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,
|
||||
-- The command for the Ollama service. You can use placeholders $prompt, $model and $body (shellescaped).
|
||||
-- This can also be a command string.
|
||||
-- The executed command must return a JSON object with { response, context }
|
||||
-- (context property is optional).
|
||||
-- list_models = '<omitted lua function>', -- Retrieves a list of model names
|
||||
debug = false -- Prints errors and the command which is run.
|
||||
}
|
||||
},
|
||||
--[[ {
|
||||
"dreamsofcode-io/nvim-dap-go",
|
||||
ft = "go",
|
||||
|
@ -46,8 +46,8 @@ autocmd("BufEnter", {
|
||||
pattern = "*",
|
||||
callback = function()
|
||||
vim.opt.formatoptions = vim.opt.formatoptions
|
||||
- "o" -- O and o, don't continue comments
|
||||
+ "r" -- But do continue when pressing enter.
|
||||
- "o" -- O and o, don't continue comments
|
||||
+ "r" -- But do continue when pressing enter.
|
||||
end,
|
||||
})
|
||||
|
||||
@ -73,10 +73,10 @@ autocmd("BufReadPost", {
|
||||
callback = function()
|
||||
local line = vim.fn.line("'\"")
|
||||
if
|
||||
line > 1
|
||||
and line <= vim.fn.line("$")
|
||||
and vim.bo.filetype ~= "commit"
|
||||
and vim.fn.index({ "xxd", "gitrebase" }, vim.bo.filetype) == -1
|
||||
line > 1
|
||||
and line <= vim.fn.line("$")
|
||||
and vim.bo.filetype ~= "commit"
|
||||
and vim.fn.index({ "xxd", "gitrebase" }, vim.bo.filetype) == -1
|
||||
then
|
||||
vim.cmd('normal! g`"')
|
||||
end
|
||||
|
Reference in New Issue
Block a user