Compare commits

...

3 Commits

Author SHA1 Message Date
8a87841d61 wip: update neovim stuff 2025-07-01 12:06:41 -05:00
8e0951d696 chore: cleanup an old comment 2025-06-30 11:06:37 -05:00
398c2a8291 fix: formatexpr with lsp changed
we need to adapt to it
2025-06-30 10:38:00 -05:00
3 changed files with 37 additions and 11 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

@ -49,7 +49,6 @@
url = "github:terrastruct/d2-vim";
flake = false;
};
# We need to pin to this version of treesitter because it breaks after this revision
roslyn-lsp = {
url = "github:zaphar/roslyn.nvim/main";
flake = false;
@ -117,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

@ -20,6 +20,10 @@ vim.opt.fileformats = "unix,dos"
-- Recommended by Avante docs
-- views can only be fully collapsed with the global statusline
vim.opt.laststatus = 3
-- formatexpr defaulted to the lsp provider by default recently
-- which breaks `gq` and company paragraph formatting in non lsp
-- contexts.
vim.opt.formatexpr = ""
vim.g.BASH_AuthorName = 'Jeremy Wall'
vim.g.BASH_AuthorRef = 'jw'
@ -256,6 +260,10 @@ vim.api.nvim_create_autocmd('LspAttach', {
if client and client.server_capabilities.codelens then
vim.lsp.codelens.refresh()
end
-- formatexpr defaulted to the lsp provider by default recently
-- which breaks `gq` and company paragraph formatting in non lsp
-- contexts.
vim.bo[args.buf].formatexpr = ""
end,
})
@ -275,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,
@ -707,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"
@ -737,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",