This commit is contained in:
2026-08-10 19:21:14 +01:00
parent b77bcf67d0
commit 2782572111
5 changed files with 137 additions and 77 deletions
+29 -12
View File
@@ -29,9 +29,20 @@
rev = "0d040ed81f7953118b81cd12681fcdfcac069803";
hash = "sha256-UF9zeO5Uujdt2MEwy2d2Lhk6JRnEN4vrEvYslv0/zaA";
};
nvimSkipModules = [ "tiny-code-action.previewers.snacks" ];
};
in
nvimSkipModules = [ "tiny-code-action.previewers.snacks" ];
};
cmp-lsp-rs = pkgs.vimUtils.buildVimPlugin {
name = "nvim-cmp-lsp-rs";
src = pkgs.fetchFromGitHub {
owner = "zjp-CN";
repo = "nvim-cmp-lsp-rs";
rev = "329075b806deb719d3ce4f55a7e443541ce5289d";
hash = "sha256-rBABhsShCrx7Gofm1mC6DQAL0KeNtQidW9eMr9kfwGI=";
};
# nvim-cmp on rtp during the require check (cmp_lsp_rs requires cmp.types.lsp at load time)
dependencies = [ pkgs.vimPlugins.nvim-cmp ];
};
in
{
imports = [
inputs.nixvim.homeModules.nixvim
@@ -222,7 +233,6 @@
":" = {
mapping.__raw = "cmp.mapping.preset.cmdline()";
sources = [
{ name = "path"; }
{ name = "cmdline"; }
];
};
@@ -239,6 +249,7 @@
{
name = "nvim_lsp";
priority = 100;
entry_filter = "require('cmp_lsp_rs').filter_out.rust_entry_filter";
}
{
name = "luasnip";
@@ -248,10 +259,6 @@
name = "buffer";
priority = 50;
}
{
name = "path";
priority = 40;
}
];
mapping = {
"<C-Space>" = "cmp.mapping.complete()";
@@ -264,8 +271,16 @@
"<Tab>" =
"cmp.mapping(function(fallback) if cmp.visible() then cmp.select_next_item() elseif require('luasnip').expand_or_jumpable() then require('luasnip').expand_or_jump() else fallback() end end, {'i', 's'})";
};
window = {
completion = {
sorting = {
comparators = [
"require('cmp.config.compare').exact"
"require('cmp.config.compare').score"
"require('cmp_lsp_rs').comparators.inscope_inherent_import"
"require('cmp_lsp_rs').comparators.sort_by_label_but_underscore_last"
];
};
window = {
completion = {
border = "rounded";
winhighlight = "Normal:Pmenu,FloatBorder:Pmenu,CursorLine:PmenuSel,Search:None";
};
@@ -312,6 +327,7 @@
};
extraPlugins = with pkgs; [
tiny-code-action
cmp-lsp-rs
];
opts = {
number = true;
@@ -325,8 +341,9 @@
mapleader = " ";
};
extraConfigLua = ''
-- LSP client writes server stderr + errors to disk on the main loop; nixd spams info logs -> 5MB+ logs. Kill it.
vim.lsp.set_log_level("off")
-- LSP client writes server stderr + errors to disk on the main loop; nixd spams info logs -> 5MB+ logs.
-- warn level: captures server stderr (incl. rust-analyzer slow-request timing) without nixd's info spam.
vim.lsp.set_log_level("warn")
-- tree-sitter-nix uses (#is-not? local) which the new nvim-treesitter main branch no longer registers
vim.treesitter.query.add_predicate("is-not?", function() return true end, { force = true })