Compare commits

...

3 Commits

4 changed files with 410 additions and 196 deletions

View File

@ -1,5 +1,11 @@
{ {
"diagnostics.disable": [ "diagnostics.disable": [
"missing-fields" "missing-fields"
],
"diagnostics.globals": [
"vim",
"make_avante_system_prompt",
"update_avante_system_prompt",
"get_server_list_prompt"
] ]
} }

View File

@ -20,6 +20,22 @@
"type": "github" "type": "github"
} }
}, },
"avante-src": {
"flake": false,
"locked": {
"lastModified": 1746602870,
"narHash": "sha256-REBOplEe2muqfVLwcpTAmXpTrHlzSfhbh8T0litDTDA=",
"owner": "yetone",
"repo": "avante.nvim",
"rev": "113913355a6b9c0fbd62cf52d0cf3e5671d0e34a",
"type": "github"
},
"original": {
"owner": "yetone",
"repo": "avante.nvim",
"type": "github"
}
},
"clio-flake": { "clio-flake": {
"inputs": { "inputs": {
"flake-compat": "flake-compat", "flake-compat": "flake-compat",
@ -46,6 +62,7 @@
}, },
"custom-flakes": { "custom-flakes": {
"inputs": { "inputs": {
"avante-src": "avante-src",
"d2-vim-src": "d2-vim-src", "d2-vim-src": "d2-vim-src",
"flake-utils": "flake-utils_3", "flake-utils": "flake-utils_3",
"gomod2nix-src": "gomod2nix-src", "gomod2nix-src": "gomod2nix-src",
@ -67,11 +84,11 @@
"zig-src": "zig-src" "zig-src": "zig-src"
}, },
"locked": { "locked": {
"lastModified": 1746458473, "lastModified": 1746633381,
"narHash": "sha256-3FFhJ18MJFlHHI1YaMKRwXURcQjmLenxIcLFtr+CjGI=", "narHash": "sha256-9Vgnz0/Myw+XdZUxNWYhfdfRzz1SSDQIFjrhaXFcJpk=",
"owner": "zaphar", "owner": "zaphar",
"repo": "nix-flakes", "repo": "nix-flakes",
"rev": "91588e10769e706024d8d03ebb4958c89e00c264", "rev": "30a4fb242f5e6542b842be1972d953d20945ed7a",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -223,6 +240,38 @@
} }
}, },
"flake-compat_4": { "flake-compat_4": {
"flake": false,
"locked": {
"lastModified": 1733328505,
"narHash": "sha256-NeCCThCEP3eCl2l/+27kNNK7QrwZB1IJCrXfrbv5oqU=",
"owner": "edolstra",
"repo": "flake-compat",
"rev": "ff81ac966bb2cae68946d5ed5fc4994f96d0ffec",
"type": "github"
},
"original": {
"owner": "edolstra",
"repo": "flake-compat",
"type": "github"
}
},
"flake-compat_5": {
"flake": false,
"locked": {
"lastModified": 1696426674,
"narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=",
"owner": "edolstra",
"repo": "flake-compat",
"rev": "0f9255e01c2351cc7d116c072cb317785dd33b33",
"type": "github"
},
"original": {
"owner": "edolstra",
"repo": "flake-compat",
"type": "github"
}
},
"flake-compat_6": {
"flake": false, "flake": false,
"locked": { "locked": {
"lastModified": 1648199409, "lastModified": 1648199409,
@ -238,7 +287,7 @@
"type": "github" "type": "github"
} }
}, },
"flake-compat_5": { "flake-compat_7": {
"flake": false, "flake": false,
"locked": { "locked": {
"lastModified": 1673956053, "lastModified": 1673956053,
@ -275,6 +324,48 @@
"type": "github" "type": "github"
} }
}, },
"flake-parts_2": {
"inputs": {
"nixpkgs-lib": [
"neovim-nightly-overlay",
"nixpkgs"
]
},
"locked": {
"lastModified": 1743550720,
"narHash": "sha256-hIshGgKZCgWh6AYJpJmRgFdR3WUbkY04o82X05xqQiY=",
"owner": "hercules-ci",
"repo": "flake-parts",
"rev": "c621e8422220273271f52058f618c94e405bb0f5",
"type": "github"
},
"original": {
"owner": "hercules-ci",
"repo": "flake-parts",
"type": "github"
}
},
"flake-parts_3": {
"inputs": {
"nixpkgs-lib": [
"neovim-nightly-overlay",
"hercules-ci-effects",
"nixpkgs"
]
},
"locked": {
"lastModified": 1743550720,
"narHash": "sha256-hIshGgKZCgWh6AYJpJmRgFdR3WUbkY04o82X05xqQiY=",
"owner": "hercules-ci",
"repo": "flake-parts",
"rev": "c621e8422220273271f52058f618c94e405bb0f5",
"type": "github"
},
"original": {
"id": "flake-parts",
"type": "indirect"
}
},
"flake-utils": { "flake-utils": {
"inputs": { "inputs": {
"systems": "systems" "systems": "systems"
@ -297,24 +388,6 @@
"inputs": { "inputs": {
"systems": "systems_9" "systems": "systems_9"
}, },
"locked": {
"lastModified": 1710146030,
"narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"flake-utils_11": {
"inputs": {
"systems": "systems_10"
},
"locked": { "locked": {
"lastModified": 1687709756, "lastModified": 1687709756,
"narHash": "sha256-Y5wKlQSkgEK2weWdOu4J3riRd+kV/VCgHsqLNTTWQ/0=", "narHash": "sha256-Y5wKlQSkgEK2weWdOu4J3riRd+kV/VCgHsqLNTTWQ/0=",
@ -329,7 +402,7 @@
"type": "github" "type": "github"
} }
}, },
"flake-utils_12": { "flake-utils_11": {
"locked": { "locked": {
"lastModified": 1649676176, "lastModified": 1649676176,
"narHash": "sha256-OWKJratjt2RW151VUlJPRALb7OU2S5s+f0vLj4o1bHM=", "narHash": "sha256-OWKJratjt2RW151VUlJPRALb7OU2S5s+f0vLj4o1bHM=",
@ -344,9 +417,9 @@
"type": "github" "type": "github"
} }
}, },
"flake-utils_13": { "flake-utils_12": {
"inputs": { "inputs": {
"systems": "systems_11" "systems": "systems_10"
}, },
"locked": { "locked": {
"lastModified": 1705309234, "lastModified": 1705309234,
@ -362,9 +435,9 @@
"type": "github" "type": "github"
} }
}, },
"flake-utils_14": { "flake-utils_13": {
"inputs": { "inputs": {
"systems": "systems_12" "systems": "systems_11"
}, },
"locked": { "locked": {
"lastModified": 1726560853, "lastModified": 1726560853,
@ -380,9 +453,9 @@
"type": "github" "type": "github"
} }
}, },
"flake-utils_15": { "flake-utils_14": {
"inputs": { "inputs": {
"systems": "systems_13" "systems": "systems_12"
}, },
"locked": { "locked": {
"lastModified": 1681202837, "lastModified": 1681202837,
@ -539,7 +612,52 @@
"type": "github" "type": "github"
} }
}, },
"git-hooks": {
"inputs": {
"flake-compat": "flake-compat_5",
"gitignore": "gitignore",
"nixpkgs": [
"neovim-nightly-overlay",
"nixpkgs"
]
},
"locked": {
"lastModified": 1746537231,
"narHash": "sha256-Wb2xeSyOsCoTCTj7LOoD6cdKLEROyFAArnYoS+noCWo=",
"owner": "cachix",
"repo": "git-hooks.nix",
"rev": "fa466640195d38ec97cf0493d6d6882bc4d14969",
"type": "github"
},
"original": {
"owner": "cachix",
"repo": "git-hooks.nix",
"type": "github"
}
},
"gitignore": { "gitignore": {
"inputs": {
"nixpkgs": [
"neovim-nightly-overlay",
"git-hooks",
"nixpkgs"
]
},
"locked": {
"lastModified": 1709087332,
"narHash": "sha256-HG2cCnktfHsKV0s4XW83gU3F57gaTljL9KNSuG6bnQs=",
"owner": "hercules-ci",
"repo": "gitignore.nix",
"rev": "637db329424fd7e46cf4185293b9cc8c88c95394",
"type": "github"
},
"original": {
"owner": "hercules-ci",
"repo": "gitignore.nix",
"type": "github"
}
},
"gitignore_2": {
"inputs": { "inputs": {
"nixpkgs": [ "nixpkgs": [
"sile-flake", "sile-flake",
@ -618,6 +736,28 @@
"type": "github" "type": "github"
} }
}, },
"hercules-ci-effects": {
"inputs": {
"flake-parts": "flake-parts_3",
"nixpkgs": [
"neovim-nightly-overlay",
"nixpkgs"
]
},
"locked": {
"lastModified": 1744693102,
"narHash": "sha256-1Z4WPGVky4w3lrhrgs89OKsLzPdtkbi1bPLNFWsoLfY=",
"owner": "hercules-ci",
"repo": "hercules-ci-effects",
"rev": "5b6cec51c9ec095a0d3fd4c8eeb53eb5c59ae33e",
"type": "github"
},
"original": {
"owner": "hercules-ci",
"repo": "hercules-ci-effects",
"type": "github"
}
},
"home-manager": { "home-manager": {
"inputs": { "inputs": {
"nixpkgs": [ "nixpkgs": [
@ -867,24 +1007,42 @@
"type": "github" "type": "github"
} }
}, },
"neovim-flake": { "neovim-nightly-overlay": {
"inputs": { "inputs": {
"flake-utils": "flake-utils_10", "flake-compat": "flake-compat_4",
"nixpkgs": "nixpkgs_12" "flake-parts": "flake-parts_2",
"git-hooks": "git-hooks",
"hercules-ci-effects": "hercules-ci-effects",
"neovim-src": "neovim-src",
"nixpkgs": "nixpkgs_12",
"treefmt-nix": "treefmt-nix"
}, },
"locked": { "locked": {
"dir": "contrib", "lastModified": 1746693006,
"lastModified": 1715862872, "narHash": "sha256-IztZLDIwNOvJCxqnBmaU7/oEjOBLJZgmLoK0ikQGQkM=",
"narHash": "sha256-FCOipXHkAbkuFw9JjEpOIJ8BkyMkjkI0Dp+SzZ4yZlw=", "owner": "nix-community",
"owner": "neovim", "repo": "neovim-nightly-overlay",
"repo": "neovim", "rev": "b969e3c7bfcb7a438382dd6e379788f762094df5",
"rev": "27fb62988e922c2739035f477f93cc052a4fee1e", "type": "github"
},
"original": {
"owner": "nix-community",
"repo": "neovim-nightly-overlay",
"type": "github"
}
},
"neovim-src": {
"flake": false,
"locked": {
"lastModified": 1746661883,
"narHash": "sha256-kjIDvE1KGhACcvAJGLgzaQDkenH8dN9Hapfc0/b/3bQ=",
"owner": "neovim",
"repo": "neovim",
"rev": "1b8ae4336db86ff95998223cc6bd8e07229d237d",
"type": "github" "type": "github"
}, },
"original": { "original": {
"dir": "contrib",
"owner": "neovim", "owner": "neovim",
"ref": "stable",
"repo": "neovim", "repo": "neovim",
"type": "github" "type": "github"
} }
@ -911,7 +1069,7 @@
}, },
"nil-flake_2": { "nil-flake_2": {
"inputs": { "inputs": {
"flake-utils": "flake-utils_11", "flake-utils": "flake-utils_10",
"nixpkgs": "nixpkgs_13", "nixpkgs": "nixpkgs_13",
"rust-overlay": "rust-overlay_6" "rust-overlay": "rust-overlay_6"
}, },
@ -995,16 +1153,16 @@
}, },
"nixpkgs_12": { "nixpkgs_12": {
"locked": { "locked": {
"lastModified": 1715787315, "lastModified": 1746576598,
"narHash": "sha256-cYApT0NXJfqBkKcci7D9Kr4CBYZKOQKDYA23q8XNuWg=", "narHash": "sha256-FshoQvr6Aor5SnORVvh/ZdJ1Sa2U4ZrIMwKBX5k2wu0=",
"owner": "nixos", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "33d1e753c82ffc557b4a585c77de43d4c922ebb5", "rev": "b3582c75c7f21ce0b429898980eddbbf05c68e55",
"type": "github" "type": "github"
}, },
"original": { "original": {
"owner": "nixos", "owner": "NixOS",
"ref": "nixos-unstable", "ref": "nixpkgs-unstable",
"repo": "nixpkgs", "repo": "nixpkgs",
"type": "github" "type": "github"
} }
@ -1282,7 +1440,7 @@
"jujutsu-flake": "jujutsu-flake", "jujutsu-flake": "jujutsu-flake",
"mcphub-flake": "mcphub-flake", "mcphub-flake": "mcphub-flake",
"neogit-src": "neogit-src_2", "neogit-src": "neogit-src_2",
"neovim-flake": "neovim-flake", "neovim-nightly-overlay": "neovim-nightly-overlay",
"nil-flake": "nil-flake_2", "nil-flake": "nil-flake_2",
"nixpkgs": "nixpkgs_14", "nixpkgs": "nixpkgs_14",
"nixpkgs-darwin": "nixpkgs-darwin", "nixpkgs-darwin": "nixpkgs-darwin",
@ -1332,8 +1490,8 @@
}, },
"runwhen-flake": { "runwhen-flake": {
"inputs": { "inputs": {
"flake-compat": "flake-compat_4", "flake-compat": "flake-compat_6",
"flake-utils": "flake-utils_12", "flake-utils": "flake-utils_11",
"naersk": "naersk_5" "naersk": "naersk_5"
}, },
"locked": { "locked": {
@ -1375,7 +1533,7 @@
}, },
"rust-overlay-flake": { "rust-overlay-flake": {
"inputs": { "inputs": {
"flake-utils": "flake-utils_13", "flake-utils": "flake-utils_12",
"nixpkgs": [ "nixpkgs": [
"nixpkgs" "nixpkgs"
] ]
@ -1530,7 +1688,7 @@
}, },
"sheetsui-flake": { "sheetsui-flake": {
"inputs": { "inputs": {
"flake-utils": "flake-utils_14", "flake-utils": "flake-utils_13",
"naersk": "naersk_6", "naersk": "naersk_6",
"nixpkgs": "nixpkgs_18", "nixpkgs": "nixpkgs_18",
"rust-overlay": "rust-overlay_7" "rust-overlay": "rust-overlay_7"
@ -1551,9 +1709,9 @@
}, },
"sile-flake": { "sile-flake": {
"inputs": { "inputs": {
"flake-compat": "flake-compat_5", "flake-compat": "flake-compat_7",
"flake-utils": "flake-utils_15", "flake-utils": "flake-utils_14",
"gitignore": "gitignore", "gitignore": "gitignore_2",
"libtexpdf-src": "libtexpdf-src", "libtexpdf-src": "libtexpdf-src",
"nixpkgs": "nixpkgs_19" "nixpkgs": "nixpkgs_19"
}, },
@ -1631,21 +1789,6 @@
"type": "github" "type": "github"
} }
}, },
"systems_13": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
},
"systems_2": { "systems_2": {
"locked": { "locked": {
"lastModified": 1681028828, "lastModified": 1681028828,
@ -1782,6 +1925,27 @@
"type": "github" "type": "github"
} }
}, },
"treefmt-nix": {
"inputs": {
"nixpkgs": [
"neovim-nightly-overlay",
"nixpkgs"
]
},
"locked": {
"lastModified": 1746216483,
"narHash": "sha256-4h3s1L/kKqt3gMDcVfN8/4v2jqHrgLIe4qok4ApH5x4=",
"owner": "numtide",
"repo": "treefmt-nix",
"rev": "29ec5026372e0dec56f890e50dbe4f45930320fd",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "treefmt-nix",
"type": "github"
}
},
"treesitter-context": { "treesitter-context": {
"flake": false, "flake": false,
"locked": { "locked": {

View File

@ -30,12 +30,7 @@
url = "github:oxalica/rust-overlay"; url = "github:oxalica/rust-overlay";
inputs.nixpkgs.follows = "nixpkgs"; inputs.nixpkgs.follows = "nixpkgs";
}; };
neovim-nightly-overlay.url = "github:nix-community/neovim-nightly-overlay";
neovim-flake = {
url = "github:neovim/neovim/stable?dir=contrib";
# NOTE(jeremy): Currently this needs a newer nixpkgs version
#inputs.nixpkgs.follows = "nixpkgs";
};
jujutsu-flake.url = "github:martinvonz/jj"; jujutsu-flake.url = "github:martinvonz/jj";
custom-flakes = { custom-flakes = {
url = "github:zaphar/nix-flakes"; url = "github:zaphar/nix-flakes";
@ -80,7 +75,7 @@
custom-flakes, custom-flakes,
unstable, unstable,
heracles-flake, heracles-flake,
neovim-flake, neovim-nightly-overlay,
clio-flake, clio-flake,
sheetsui-flake, sheetsui-flake,
mcphub-flake, mcphub-flake,
@ -90,6 +85,7 @@
vimModule = system: let vimModule = system: let
nil-pkg = nil-flake.packages."${system}".default; nil-pkg = nil-flake.packages."${system}".default;
mcp-hub-binary = custom-flakes.packages."${system}".mcp-hub; mcp-hub-binary = custom-flakes.packages."${system}".mcp-hub;
notion-mcp-server = custom-flakes.packages."${system}".notion-mcp-server;
in in
{ config, pkgs, ...}: let { config, pkgs, ...}: let
unstablePkgs = import unstable { inherit system; }; unstablePkgs = import unstable { inherit system; };
@ -110,7 +106,6 @@
nvim-treesitter-context = custom-flakes.packages."${system}".nvim-treesitter-context; nvim-treesitter-context = custom-flakes.packages."${system}".nvim-treesitter-context;
roslyn-nvim = custom-flakes.packages."${system}".roslyn-nvim; roslyn-nvim = custom-flakes.packages."${system}".roslyn-nvim;
ionide-nvim = custom-flakes.packages."${system}".ionide-nvim; ionide-nvim = custom-flakes.packages."${system}".ionide-nvim;
nvim = neovim-flake.packages."${system}".neovim;
# TODO(zaphar): Until nixpkgs update to a newer version of tree-sitter the queries will be wrong # TODO(zaphar): Until nixpkgs update to a newer version of tree-sitter the queries will be wrong
# for csharp # for csharp
#tree-sitter-csharp = pkgs.callPackage ./nvim-treesitter-csharp.nix { #tree-sitter-csharp = pkgs.callPackage ./nvim-treesitter-csharp.nix {
@ -124,38 +119,15 @@
# inherit (pkgs) fetchFromGitHub; # inherit (pkgs) fetchFromGitHub;
#}; #};
mcphub-nvim = mcphub-flake.packages."${system}".default; mcphub-nvim = mcphub-flake.packages."${system}".default;
in { my-neovim = pkgs.wrapNeovim unstablePkgs.neovim-unwrapped {
imports = [ configure = {
./program-neovim.nix customRC = "lua << EOF
];
config = {
environment.variables = {
EDITOR="nvim";
PAGER="less -R";
OMNISHARP_BIN = "${pkgs.omnisharp-roslyn}/bin/OmniSharp";
};
nixpkgs.overlays = [
(final: prev: {
custom-neovim = nvim;
lorri = unstablePkgs.lorri;
avante-nvim = unstablePkgs.vimPlugins.avante-nvim;
copilot-lua = unstablePkgs.vimPlugins.copilot-lua;
})
];
programs = with pkgs; {
neovim.enable = true;
neovim.vimAlias = true;
neovim.viAlias = true;
neovim.package = pkgs.custom-neovim;
neovim.configure = {
customRC = "lua << EOF
${builtins.readFile ./init.lua} ${builtins.readFile ./init.lua}
EOF"; EOF";
packages.myVimPackage = { packages.myPlugins = {
start = (with pkgs.vimPlugins; [ start = (with pkgs.vimPlugins; [
copilot-lua copilot-lua
avante-nvim custom-flakes.packages."${system}".avante-nvim
vim-sile vim-sile
nvim-tree-lua nvim-tree-lua
nvim-lspconfig nvim-lspconfig
@ -232,9 +204,26 @@ EOF";
neogit-nvim neogit-nvim
# tree-sitter-csharp.neovim-plugin # Until nixpkgs updates their nvim-treesitter config the csharp queries will be broken # tree-sitter-csharp.neovim-plugin # Until nixpkgs updates their nvim-treesitter config the csharp queries will be broken
]; ];
}; };
}; };
}; };
in {
imports = [
./program-neovim.nix
];
config = {
environment.variables = {
EDITOR="nvim";
PAGER="less -R";
OMNISHARP_BIN = "${pkgs.omnisharp-roslyn}/bin/OmniSharp";
};
nixpkgs.overlays = [
(final: prev: {
lorri = unstablePkgs.lorri;
copilot-lua = unstablePkgs.vimPlugins.copilot-lua;
})
];
environment.systemPackages = (with pkgs; [ environment.systemPackages = (with pkgs; [
terraform-ls terraform-ls
nodePackages.typescript-language-server nodePackages.typescript-language-server
@ -251,6 +240,8 @@ EOF";
devenv devenv
unstablePkgs.fq unstablePkgs.fq
mcp-hub-binary mcp-hub-binary
notion-mcp-server
my-neovim
]); ]);
}; };
}; };

View File

@ -32,15 +32,15 @@ vim.cmd("noswapfile")
vim.cmd("syntax on") vim.cmd("syntax on")
vim.cmd("filetype plugin on") vim.cmd("filetype plugin on")
vim.api.nvim_create_autocmd({"BufEnter", "BufWinEnter"}, { vim.api.nvim_create_autocmd({ "BufEnter", "BufWinEnter" }, {
pattern = {"*.qnt"}, pattern = { "*.qnt" },
callback = function(args) callback = function(args)
vim.lsp.start({ vim.lsp.start({
name = 'quint', name = 'quint',
cmd = {'quint-language-server', '--stdio'}, cmd = { 'quint-language-server', '--stdio' },
root_dir = vim.fs.dirname(vim.uri_from_bufnr(args.buf)) root_dir = vim.fs.dirname(vim.uri_from_bufnr(args.buf))
}) })
end, end,
}) })
vim.cmd([[ vim.cmd([[
@ -76,7 +76,7 @@ au BufNewFile,BufRead *.hrl filetype indent off
]]) ]])
vim.cmd([[ vim.cmd([[
au BufNewFile,BufRead *.nix set tabstop=2 nosmarttab au BufNewFile,BufRead *.nix set tabstop=2 nosmarttab
]]) ]])
vim.cmd([[ vim.cmd([[
@ -148,7 +148,7 @@ local caps = vim.tbl_deep_extend(
local lspconfig = require("lspconfig") local lspconfig = require("lspconfig")
-- Typst -- Typst
lspconfig.tinymist.setup{ lspconfig.tinymist.setup {
capabilities = caps, capabilities = caps,
settings = { settings = {
exportPdf = "onSave", exportPdf = "onSave",
@ -163,11 +163,11 @@ lspconfig.nil_ls.setup {
capabilities = caps, capabilities = caps,
} }
lspconfig.jedi_language_server.setup{} lspconfig.jedi_language_server.setup {}
require('roslyn').setup({ require('roslyn').setup({
-- client, bufnr -- client, bufnr
on_attach = function (_, _) on_attach = function(_, _)
--vim.notify(vim.inspect(client)) --vim.notify(vim.inspect(client))
end, end,
sdk_framework = "net8.0", sdk_framework = "net8.0",
@ -234,7 +234,7 @@ vim.api.nvim_create_autocmd('LspAttach', {
vim.keymap.set({ "n", "v" }, "<Leader>a", vim.lsp.buf.code_action, opts) vim.keymap.set({ "n", "v" }, "<Leader>a", vim.lsp.buf.code_action, opts)
vim.keymap.set("n", "<Leader>f", vim.lsp.buf.format, opts) vim.keymap.set("n", "<Leader>f", vim.lsp.buf.format, opts)
local client = vim.lsp.get_client_by_id(args.data.client_id) local client = vim.lsp.get_client_by_id(args.data.client_id)
---@diagnostic disable-next-line: undefined-field ---@diagnostic disable-next-line: undefined-field
if client and client.server_capabilities.codelens then if client and client.server_capabilities.codelens then
vim.lsp.codelens.refresh() vim.lsp.codelens.refresh()
end end
@ -243,9 +243,9 @@ vim.api.nvim_create_autocmd('LspAttach', {
vim.api.nvim_create_autocmd({ 'BufEnter', 'InsertLeave', 'CursorHold' }, { vim.api.nvim_create_autocmd({ 'BufEnter', 'InsertLeave', 'CursorHold' }, {
callback = function(args) callback = function(args)
local clients = vim.lsp.get_clients({bufnr=args.buf}) local clients = vim.lsp.get_clients({ bufnr = args.buf })
for cid = 1, #clients do for cid = 1, #clients do
---@diagnostic disable-next-line: undefined-field ---@diagnostic disable-next-line: undefined-field
if clients[cid].server_capabilities.codelens then if clients[cid].server_capabilities.codelens then
vim.lsp.codelens.refresh() vim.lsp.codelens.refresh()
break break
@ -529,7 +529,7 @@ lean.setup {
vim.keymap.set({ "n", "v" }, "<Leader>ti", function() vim.cmd("LeanInfoviewToggle") end, opts) vim.keymap.set({ "n", "v" }, "<Leader>ti", function() vim.cmd("LeanInfoviewToggle") end, opts)
vim.keymap.set({ "n", "v" }, "<Leader>sg", function() vim.cmd("LeanGoal") end, opts) vim.keymap.set({ "n", "v" }, "<Leader>sg", function() vim.cmd("LeanGoal") end, opts)
vim.keymap.set({ "n", "v" }, "<Leader>stg", function() vim.cmd("LeanTermGoal") end, opts) vim.keymap.set({ "n", "v" }, "<Leader>stg", function() vim.cmd("LeanTermGoal") end, opts)
vim.api.nvim_set_option_value('omnifunc', 'v:lua.vim.lsp.omnifunc', {scope = "local", buf=bufnr}) vim.api.nvim_set_option_value('omnifunc', 'v:lua.vim.lsp.omnifunc', { scope = "local", buf = bufnr })
end end
}, },
mappings = true, mappings = true,
@ -545,8 +545,10 @@ vim.keymap.set("n", "<Leader>rn", vim.lsp.buf.rename)
vim.keymap.set("n", "<Leader>sl", telescope_builtins.lsp_workspace_symbols) vim.keymap.set("n", "<Leader>sl", telescope_builtins.lsp_workspace_symbols)
vim.keymap.set("n", "<Leader>dl", telescope_builtins.diagnostics) vim.keymap.set("n", "<Leader>dl", telescope_builtins.diagnostics)
vim.keymap.set("n", "<Leader>rg", telescope_builtins.live_grep) vim.keymap.set("n", "<Leader>rg", telescope_builtins.live_grep)
vim.keymap.set("n", "<Leader>bl", function() telescope_builtins.buffers({ vim.keymap.set("n", "<Leader>bl", function()
}) end) telescope_builtins.buffers({
})
end)
vim.keymap.set("n", "<leader>lds", telescope_builtins.lsp_document_symbols, { desc = "[D]ocument [S]ymbols" }) vim.keymap.set("n", "<leader>lds", telescope_builtins.lsp_document_symbols, { desc = "[D]ocument [S]ymbols" })
vim.keymap.set("n", "<leader>lws", telescope_builtins.lsp_dynamic_workspace_symbols, { desc = "[W]orkspace [S]ymbols" }) vim.keymap.set("n", "<leader>lws", telescope_builtins.lsp_dynamic_workspace_symbols, { desc = "[W]orkspace [S]ymbols" })
@ -572,67 +574,67 @@ require('lualine').setup {
}, },
sections = { sections = {
-- left side -- left side
lualine_a = {'mode'}, lualine_a = { 'mode' },
lualine_b = {'filename'}, lualine_b = { 'filename' },
lualine_c = {'encoding', 'fileformat', 'filetype'}, lualine_c = { 'encoding', 'fileformat', 'filetype' },
-- right side -- right side
lualine_x = {'diagnostics'}, lualine_x = { 'diagnostics' },
lualine_y = {'progress', 'lsp_progress'}, lualine_y = { 'progress', 'lsp_progress' },
lualine_z = {'location'} lualine_z = { 'location' }
} }
} }
-- Hunk diff tree viewer and editor. Replacement for Meld and company -- Hunk diff tree viewer and editor. Replacement for Meld and company
local hunk = require("hunk") local hunk = require("hunk")
hunk.setup({ hunk.setup({
keys = { keys = {
global = { global = {
quit = { "q" }, quit = { "q" },
accept = { "<leader><Cr>" }, accept = { "<leader><Cr>" },
focus_tree = { "<leader>e" }, focus_tree = { "<leader>e" },
},
tree = {
expand_node = { "l", "<Right>" },
collapse_node = { "h", "<Left>" },
open_file = { "<Cr>" },
toggle_file = { "a" },
},
diff = {
toggle_line = { "a" },
toggle_hunk = { "A" },
},
}, },
tree = { ui = {
expand_node = { "l", "<Right>" }, tree = {
collapse_node = { "h", "<Left>" }, -- Mode can either be `nested` or `flat`
mode = "nested",
open_file = { "<Cr>" }, width = 35,
},
toggle_file = { "a" }, --- Can be either `vertical` or `horizontal`
layout = "vertical",
}, },
diff = { icons = {
toggle_line = { "a" }, selected = "󰡖",
toggle_hunk = { "A" }, deselected = "",
partially_selected = "󰛲",
folder_open = "",
folder_closed = "",
}, },
},
ui = { -- Called right after each window and buffer are created.
tree = { --hooks = {
-- Mode can either be `nested` or `flat` -- ---@param _context { buf: number, tree: NuiTree, opts: table }
mode = "nested", -- on_tree_mount = function(_context) end,
width = 35, -- ---@param _context { buf: number, win: number }
}, -- on_diff_mount = function(_context) end,
--- Can be either `vertical` or `horizontal` --},
layout = "vertical",
},
icons = {
selected = "󰡖",
deselected = "",
partially_selected = "󰛲",
folder_open = "",
folder_closed = "",
},
-- Called right after each window and buffer are created.
--hooks = {
-- ---@param _context { buf: number, tree: NuiTree, opts: table }
-- on_tree_mount = function(_context) end,
-- ---@param _context { buf: number, win: number }
-- on_diff_mount = function(_context) end,
--},
}) })
local dap = require('dap') local dap = require('dap')
@ -678,48 +680,99 @@ local mcphub = require("mcphub")
mcphub.setup({ mcphub.setup({
-- This sets vim.g.mcphub_auto_approve to false by default (can also be toggled from the HUB UI with `ga`) -- This sets vim.g.mcphub_auto_approve to false by default (can also be toggled from the HUB UI with `ga`)
config = vim.fn.expand("~/.config/mcphub/servers.json"), config = vim.fn.expand("~/.config/mcphub/servers.json"),
auto_approve = false, auto_approve = true,
auto_toggle_mcp_servers = true, -- Let LLMs start and stop MCP servers automatically auto_toggle_mcp_servers = true, -- Let LLMs start and stop MCP servers automatically
extensions = { extensions = {
avante = { avante = {
make_slash_commands = true, -- make /slash commands from MCP server prompts make_slash_commands = true, -- make /slash commands from MCP server prompts
} },
}, },
cmd = "mcp-hub"; cmd = "mcp-hub",
}) })
local hub_instance = mcphub.get_hub_instance(); function get_server_list_prompt(hub_instance)
-- returns a list of mcp-servers with a `name` and a list of tools with `name`
local mcp_tool_prompt = "# MCP SERVERS\n\nThe Model Context Protocol (MCP) enables communication between the system and locally running MCP servers that provide additional tools and resources to extend your capabilities.\n\n# Connected MCP Servers\n\nWhen a server is connected, you can use the server's tools via the `use_mcp_tool` tool, and access the server's resources via the `access_mcp_resource` tool.\nNote: Server names are case sensitive and you should always use the exact full name like `Firecrawl MCP` or `src/user/main/time-mcp` etc\n\n"
if not hub_instance then
return ""
end
local servers = hub_instance:get_servers()
if not servers or #servers == 0 then
return ""
end
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
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"
if tool.description then
mcp_tool_prompt = mcp_tool_prompt .. " - Description: " .. tool.description .. "\n"
end
end
mcp_tool_prompt = mcp_tool_prompt .. "\n"
end
end
return mcp_tool_prompt
end
function make_avante_system_prompt(hub_instance)
return hub_instance and get_server_list_prompt(hub_instance) or ""
end
function update_avante_system_prompt()
local hub_instance = mcphub.get_hub_instance();
local system_prompt = make_avante_system_prompt(hub_instance)
if system_prompt then
require("avante.config").override({system_prompt = system_prompt})
end
end
require('copilot').setup(); require('copilot').setup();
require('avante').setup ({ require('avante').setup({
provider = "claude", provider = "claude",
cursor_applying_provider = nil, -- default to whatever provider is configured
mode = "agentic", mode = "agentic",
cursor_applying_provider = nil, -- default to whatever provide is configured
claude = { claude = {
endpoint = "https://api.anthropic.com", endpoint = "https://api.anthropic.com",
model = "claude-3-7-sonnet-20250219", model = "claude-3-7-sonnet-20250219",
timeout = 30000, -- Timeout in milliseconds timeout = 30000, -- Timeout in milliseconds
temperature = 0, temperature = 0,
max_tokens = 20480, max_tokens = 20480,
},
copilot = {
model = "claude-3.7-sonnet",
},
rag_service = {
enabled = false,
host_mount = os.getenv("HOME"), -- Host mount path for the rag service
provider = "ollama", -- The provider to use for RAG service (e.g. openai or ollama)
llm_model = "llama3", -- The LLM model to use for RAG service
embed_model = "", -- The embedding model to use for RAG service
endpoint = "http://localhost:11434", -- The API endpoint for RAG service
}, },
behavior = { behavior = {
enable_cursor_planning_mode = true, enable_cursor_planning_mode = true,
}, },
--system_prompt = hub_instance:get_active_servers_prompt(), system_prompt = make_avante_system_prompt(mcphub.get_hub_instance()),
-- Using function prevents requiring mcphub before it's loaded custom_tools = { require("mcphub.extensions.avante").mcp_tool() },
custom_tools = require("mcphub.extensions.avante").mcp_tool(),
-- Disable these because we'll use the mcphub versions instead -- Disable these because we'll use the mcphub versions instead
disabled_tools = { --disabled_tools = {
"list_files", -- Built-in file operations -- "list_files", -- Built-in file operations
"search_files", -- "search_files",
"read_file", -- "read_file",
"create_file", -- "create_file",
"rename_file", -- "rename_file",
"delete_file", -- "delete_file",
"create_dir", -- "create_dir",
"rename_dir", -- "rename_dir",
"delete_dir", -- "delete_dir",
"bash", -- Built-in terminal access -- "bash", -- Built-in terminal access
}, --},
}) })