wip: update neovim stuff

This commit is contained in:
Jeremy Wall 2025-06-30 10:22:32 -05:00
parent 8e0951d696
commit 8a87841d61
3 changed files with 29 additions and 10 deletions

View File

@ -1711,11 +1711,11 @@
},
"unstable": {
"locked": {
"lastModified": 1747312588,
"narHash": "sha256-MmJvj6mlWzeRwKGLcwmZpKaOPZ5nJb/6al5CXqJsgjo=",
"lastModified": 1751349533,
"narHash": "sha256-5XRh0mB06/7WYDLu9ZXsx1GhyvvNVZDtPyg34sUCLJs=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "b1bebd0fe266bbd1820019612ead889e96a8fa2d",
"rev": "bdfd0f2afcf764e531d0960c821ab070a6174b15",
"type": "github"
},
"original": {

View File

@ -116,15 +116,13 @@
nixpkgs.overlays = [
(final: prev: {
lorri = unstablePkgs.lorri;
avante-nvim = unstablePkgs.vimPlugins.avante-nvim;
copilot-lua = unstablePkgs.vimPlugins.copilot-lua;
})
];
programs = with pkgs; {
programs = with unstablePkgs; {
neovim.enable = true;
neovim.vimAlias = true;
neovim.viAlias = true;
#neovim.package = pkgs.custom-neovim;
neovim.package = unstablePkgs.neovim-unwrapped;
neovim.configure = {
customRC = "lua << EOF
${builtins.readFile ./init.lua}

View File

@ -283,7 +283,6 @@ vim.api.nvim_create_autocmd({ 'BufEnter', 'InsertLeave', 'CursorHold' }, {
-- LSP Diagnostics Options Setup
vim.diagnostic.config({
virtual_text = false,
signs = true,
update_in_insert = true,
underline = true,
severity_sort = false,
@ -715,7 +714,7 @@ function get_server_list_prompt(hub_instance)
for _, server in ipairs(servers) do
mcp_tool_prompt = mcp_tool_prompt .. "## server name: `" .. server.name .. "`\n\n"
if server.capabilities.tools and #server.capabilities.tools > 0 then
if server.capabilities and server.capabilities.tools and #server.capabilities.tools > 0 then
mcp_tool_prompt = mcp_tool_prompt .. "Available tools:\n\n"
for _, tool in ipairs(server.capabilities.tools) do
mcp_tool_prompt = mcp_tool_prompt .. "- tool name: `" .. tool.name .. "`\n"
@ -745,7 +744,29 @@ end
vim.keymap.set("n", "<Leader>ab", function() require('avante').get().file_selector:add_buffer_files() end)
vim.keymap.set("n", "<Leader>af", function() require('avante').get().file_selector:add_current_buffer() end)
require('copilot').setup()
get_root_dir = function()
-- First try to get the root path from LSP
local bufnr = vim.api.nvim_get_current_buf()
local clients = vim.lsp.get_clients({ bufnr = bufnr })
-- Check if we have an active LSP client with a root_dir
for _, client in ipairs(clients) do
if client.config and client.config.root_dir then
return client.config.root_dir
end
end
-- Fall back to file-based detection
local root_file = vim.fs.find(function(name, path)
return name:match('(pyproject.toml|.sln|Cargo.toml|.git)$')
end, { upward = true })[1]
return root_file and vim.fs.dirname(root_file) or vim.fn.getcwd()
end
require('copilot').setup({
root_dir = get_root_dir,
})
require('avante').setup({
provider = "claude",