update fold method plus fix golangci lint causing error
also add keybinds to codecompanion
This commit is contained in:
49
lua/plugins/ai/avante.lua
Normal file
49
lua/plugins/ai/avante.lua
Normal file
@ -0,0 +1,49 @@
|
||||
return {
|
||||
{
|
||||
'yetone/avante.nvim',
|
||||
build = 'make',
|
||||
event = 'VeryLazy',
|
||||
version = false, -- Never set this value to "*"! Never!
|
||||
---@module 'avante'
|
||||
---@type avante.Config
|
||||
opts = {
|
||||
-- add any opts here
|
||||
-- for example
|
||||
provider = 'ollama',
|
||||
providers = {
|
||||
ollama = {
|
||||
model = 'deepseek-r1:8b',
|
||||
timeout = 30000, -- Timeout in milliseconds
|
||||
extra_request_body = {
|
||||
temperature = 0.5,
|
||||
max_tokens = 20480,
|
||||
},
|
||||
},
|
||||
},
|
||||
selector = {
|
||||
--- @alias avante.SelectorProvider "native" | "fzf_lua" | "mini_pick" | "snacks" | "telescope" | fun(selector: avante.ui.Selector): nil
|
||||
--- @type avante.SelectorProvider
|
||||
provider = 'fzf',
|
||||
-- Options override for custom providers
|
||||
provider_opts = {},
|
||||
},
|
||||
},
|
||||
dependencies = {
|
||||
'nvim-treesitter/nvim-treesitter',
|
||||
'nvim-lua/plenary.nvim',
|
||||
'MunifTanjim/nui.nvim',
|
||||
--- The below dependencies are optional,
|
||||
'hrsh7th/nvim-cmp', -- autocompletion for avante commands and mentions
|
||||
'ibhagwan/fzf-lua', -- for file_selector provider fzf
|
||||
'nvim-tree/nvim-web-devicons', -- or echasnovski/mini.icons
|
||||
{
|
||||
-- Make sure to set this up properly if you have lazy=true
|
||||
'MeanderingProgrammer/render-markdown.nvim',
|
||||
opts = {
|
||||
file_types = { 'markdown', 'Avante' },
|
||||
},
|
||||
ft = { 'markdown', 'Avante' },
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
@ -5,17 +5,21 @@ return {
|
||||
{ 'nvim-treesitter/nvim-treesitter', build = ':TSUpdate' },
|
||||
{ 'nvim-lua/plenary.nvim' },
|
||||
},
|
||||
keys = {
|
||||
{ '<leader>cc', '<cmd>CodeCompanionChat Toggle<cr>', desc = 'Open AI chat' },
|
||||
{ '<leader>cw', '<cmd>CodeCompanionAction<cr>', desc = 'Start new cody chat' },
|
||||
},
|
||||
opts = {
|
||||
adapters = {
|
||||
ollama = function()
|
||||
return require('codecompanion.adapters').extend('ollama', {
|
||||
schema = {
|
||||
model = {
|
||||
default = 'hf.co/Qwen/Qwen2.5-Coder-7B-Instruct-GGUF:latest',
|
||||
},
|
||||
num_ctx = {
|
||||
default = 4096,
|
||||
default = 'deepseek-r1',
|
||||
},
|
||||
-- num_ctx = {
|
||||
-- default = 4096,
|
||||
-- },
|
||||
},
|
||||
})
|
||||
end,
|
||||
|
||||
1122
lua/plugins/ai/config.lua
Normal file
1122
lua/plugins/ai/config.lua
Normal file
File diff suppressed because it is too large
Load Diff
@ -3,4 +3,5 @@ if file ~= '' then
|
||||
return require 'plugins.ai.cody'
|
||||
else
|
||||
return require 'plugins.ai.codecompanion'
|
||||
-- return require 'plugins.ai.avante'
|
||||
end
|
||||
|
||||
@ -1,19 +1,21 @@
|
||||
return {
|
||||
enable = function() -- disable lsp if wrong version installed
|
||||
local enable = true
|
||||
vim
|
||||
.system({ 'golangci-lint', '--version' }, { text = true }, function(out)
|
||||
if out.code ~= 0 then
|
||||
enable = false
|
||||
return
|
||||
end
|
||||
if out.stdout:match ' 1%.%d+%.%d+' then
|
||||
enable = false
|
||||
return
|
||||
end
|
||||
end)
|
||||
:wait()
|
||||
local ok, _ = pcall(function()
|
||||
vim
|
||||
.system({ 'golangci-lint', '--version' }, { text = true }, function(out)
|
||||
if out.code ~= 0 then
|
||||
enable = false
|
||||
return
|
||||
end
|
||||
if out.stdout:match ' 1%.%d+%.%d+' then
|
||||
enable = false
|
||||
return
|
||||
end
|
||||
end)
|
||||
:wait()
|
||||
end)
|
||||
|
||||
return enable
|
||||
return enable and ok
|
||||
end,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user