update fold method plus fix golangci lint causing error

also add keybinds to codecompanion
This commit is contained in:
2025-06-20 11:49:38 +01:00
parent ec9a456c74
commit 76f1f2fcc1
6 changed files with 1199 additions and 17 deletions

View File

@ -65,3 +65,7 @@ vim.o.termguicolors = true
-- enable spell checking -- enable spell checking
vim.o.spell = true vim.o.spell = true
vim.o.spelllang = 'en_gb' vim.o.spelllang = 'en_gb'
vim.o.foldmethod = 'expr'
vim.o.foldexpr = 'nvim_treesitter#foldexpr()'
vim.o.foldenable = false

49
lua/plugins/ai/avante.lua Normal file
View 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' },
},
},
},
}

View File

@ -5,17 +5,21 @@ return {
{ 'nvim-treesitter/nvim-treesitter', build = ':TSUpdate' }, { 'nvim-treesitter/nvim-treesitter', build = ':TSUpdate' },
{ 'nvim-lua/plenary.nvim' }, { '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 = { opts = {
adapters = { adapters = {
ollama = function() ollama = function()
return require('codecompanion.adapters').extend('ollama', { return require('codecompanion.adapters').extend('ollama', {
schema = { schema = {
model = { model = {
default = 'hf.co/Qwen/Qwen2.5-Coder-7B-Instruct-GGUF:latest', default = 'deepseek-r1',
},
num_ctx = {
default = 4096,
}, },
-- num_ctx = {
-- default = 4096,
-- },
}, },
}) })
end, end,

1122
lua/plugins/ai/config.lua Normal file

File diff suppressed because it is too large Load Diff

View File

@ -3,4 +3,5 @@ if file ~= '' then
return require 'plugins.ai.cody' return require 'plugins.ai.cody'
else else
return require 'plugins.ai.codecompanion' return require 'plugins.ai.codecompanion'
-- return require 'plugins.ai.avante'
end end

View File

@ -1,19 +1,21 @@
return { return {
enable = function() -- disable lsp if wrong version installed enable = function() -- disable lsp if wrong version installed
local enable = true local enable = true
vim local ok, _ = pcall(function()
.system({ 'golangci-lint', '--version' }, { text = true }, function(out) vim
if out.code ~= 0 then .system({ 'golangci-lint', '--version' }, { text = true }, function(out)
enable = false if out.code ~= 0 then
return enable = false
end return
if out.stdout:match ' 1%.%d+%.%d+' then end
enable = false if out.stdout:match ' 1%.%d+%.%d+' then
return enable = false
end return
end) end
:wait() end)
:wait()
end)
return enable return enable and ok
end, end,
} }