Compare commits

..

7 Commits

Author SHA1 Message Date
0cdec9232a swap to obsidian.nvim fork 2025-08-18 12:12:54 +01:00
d9f0034693 can set ai with env vars 2025-07-18 00:27:12 +01:00
cfac74a751 update lsp for rust 2025-07-18 00:12:30 +01:00
21bedced4f update obsidian config 2025-07-18 00:12:18 +01:00
8dd515d654 add treesitter context 2025-07-14 09:16:25 +01:00
2f5b79505f switch back to ollama now that qwen3 works with tools 2025-07-14 09:11:35 +01:00
b854338b20 use on_init to check golangci_lint_ls version
also ensure language servers are compatible with navbuddy before
registering them
2025-07-14 09:10:20 +01:00
6 changed files with 97 additions and 66 deletions

View File

@ -1,3 +1,4 @@
local provider = vim.env.AI_PROVIDER
return { return {
{ {
'olimorris/codecompanion.nvim', 'olimorris/codecompanion.nvim',
@ -29,7 +30,7 @@ return {
return require('codecompanion.adapters').extend('ollama', { return require('codecompanion.adapters').extend('ollama', {
schema = { schema = {
model = { model = {
default = 'devstral', default = 'qwen3:14b',
}, },
}, },
}) })
@ -42,7 +43,7 @@ return {
}, },
}, },
env = { env = {
api_key = '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', api_key = vim.env.ANTHROPIC_API_KEY,
}, },
}) })
end, end,
@ -50,9 +51,9 @@ return {
}, },
--Refer to: https://github.com/olimorris/codecompanion.nvim/blob/main/lua/codecompanion/config.lua --Refer to: https://github.com/olimorris/codecompanion.nvim/blob/main/lua/codecompanion/config.lua
strategies = { strategies = {
chat = { adapter = 'anthropic' }, chat = { adapter = provider or 'anthropic' },
inline = { adapter = 'anthropic' }, inline = { adapter = provider or 'anthropic' },
cmd = { adapter = 'anthropic' }, cmd = { adapter = provider or 'anthropic' },
}, },
}, },
}, },

View File

@ -1,21 +0,0 @@
return {
enable = function() -- disable lsp if wrong version installed
local enable = true
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 and ok
end,
}

View File

@ -1,5 +1,11 @@
return function(client, bufnr) return function(client, bufnr)
if client.server_capabilities.documentSymbolProvider then
require('nvim-navbuddy').attach(client, bufnr) require('nvim-navbuddy').attach(client, bufnr)
end
if client.server_capabilities.inlayHintProvider ~= nil and client.server_capabilities.inlayHintProvider.resolveProvider then
vim.lsp.inlay_hint.enable(true, { bufnr = bufnr })
end
local nmap = function(keys, func, desc) local nmap = function(keys, func, desc)
if desc then if desc then

View File

@ -1,5 +1,25 @@
local M = {} local M = {}
local enable = {
['golangci_lint_ls'] = function()
local enable = true
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 and ok
end,
}
function M.setup() function M.setup()
local servers = { local servers = {
ts_ls = { filetypes = { 'javascript', 'typescript', 'javascriptreact', 'typescriptreact' } }, ts_ls = { filetypes = { 'javascript', 'typescript', 'javascriptreact', 'typescriptreact' } },
@ -16,34 +36,36 @@ function M.setup()
'-Wclippy::complexity', '-Wclippy::complexity',
'-Wclippy::pedantic', '-Wclippy::pedantic',
'-Wclippy::perf', '-Wclippy::perf',
'-Aclippy::missing_errors_doc',
'-Aclippy::missing_panics_doc',
}, },
}, },
}, },
}, },
}, },
golangci_lint_ls = require 'plugins.lsp.golangci_lint_ls', golangci_lint_ls = {
filetypes = { 'go' },
on_init = function(client)
local name = client.name
if enable[name] then
if not enable[name]() then
vim.notify('Disabling language server ' .. name, vim.log.levels.WARN)
vim.lsp.enable(client.name, false)
return
end
end
end,
},
erlangls = { cmd = { '/home/fergusmolloy/.local/bin/erlang_ls' }, filetypes = { 'erlang' } }, erlangls = { cmd = { '/home/fergusmolloy/.local/bin/erlang_ls' }, filetypes = { 'erlang' } },
elixirls = { cmd = { 'elixir-ls' }, filetypes = { 'elixir' } }, elixirls = { cmd = { 'elixir-ls' }, filetypes = { 'elixir' } },
lua_ls = require 'plugins.lsp.lua_ls', lua_ls = require 'plugins.lsp.lua_ls',
} }
local on_attach = require 'plugins.lsp.on_attach'
local lspconfig = require 'lspconfig'
for server, config in pairs(servers) do for server, config in pairs(servers) do
if config['enable'] then
if not config.enable() then
vim.notify('Disabling language server ' .. server, vim.log.levels.WARN)
goto continue
end
end
config.capabilities = require('blink.cmp').get_lsp_capabilities(config.capabilities) config.capabilities = require('blink.cmp').get_lsp_capabilities(config.capabilities)
config.on_attach = require 'plugins.lsp.on_attach' config.on_attach = require 'plugins.lsp.on_attach'
vim.lsp.enable(server) vim.lsp.enable(server)
vim.lsp.config(server, config) vim.lsp.config(server, config)
::continue::
end end
end end

View File

@ -1,28 +1,41 @@
local note_location = vim.env.OBSIDIAN_VAULT
if note_location == '' then
note_location = '~/notes'
end
return { return {
-- { {
-- 'epwalsh/obsidian.nvim', 'obsidian-nvim/obsidian.nvim',
-- version = '*', version = '*',
-- ft = 'markdown', ft = 'markdown',
-- dependencies = { dependencies = {
-- 'nvim-lua/plenary.nvim', 'nvim-lua/plenary.nvim',
-- }, },
-- config = function(_, opts) config = function(_, opts)
-- require('obsidian').setup(opts) require('obsidian').setup(opts)
-- vim.api.nvim_create_autocmd('FileType', { vim.api.nvim_create_autocmd('FileType', {
-- group = vim.api.nvim_create_augroup('MarkdownConceal', {}), group = vim.api.nvim_create_augroup('MarkdownConceal', {}),
-- pattern = 'markdown', pattern = 'markdown',
-- callback = function(ev) callback = function(ev)
-- vim.opt_local.conceallevel = 2 vim.opt_local.conceallevel = 2
-- end, vim.opt_local.concealcursor = 'cn'
-- }) end,
-- end, })
-- opts = { end,
-- workspaces = { opts = {
-- { legacy_commands = false,
-- name = 'notes', picker = {
-- path = '~/notes', name = 'fzf-lua',
-- }, },
-- }, completion = {
-- }, nvim_cmp = false,
-- }, blink = true,
},
workspaces = {
{
name = 'notes',
path = note_location,
},
},
},
},
} }

View File

@ -3,9 +3,14 @@ return {
'nvim-treesitter/nvim-treesitter', 'nvim-treesitter/nvim-treesitter',
dependencies = { dependencies = {
'nvim-treesitter/nvim-treesitter-textobjects', -- maybe try mini.ai instead? 'nvim-treesitter/nvim-treesitter-textobjects', -- maybe try mini.ai instead?
'nvim-treesitter/nvim-treesitter-context',
}, },
build = ':TSUpdate', build = ':TSUpdate',
main = 'nvim-treesitter.configs', -- Sets main module to use for opts main = 'nvim-treesitter.configs', -- Sets main module to use for opts
config = function(_, opts)
require('nvim-treesitter.configs').setup(opts)
require('treesitter-context').setup(opts.context)
end,
opts = { opts = {
auto_install = false, auto_install = false,
highlight = { enable = true }, highlight = { enable = true },
@ -72,6 +77,11 @@ return {
include_surrounding_whitespace = true, include_surrounding_whitespace = true,
}, },
}, },
context = {
enable = true,
max_lines = 3,
trim_scope = 'innner', -- show inner most context (could be outer)
},
}, },
}, },
} }