mirror of
https://github.com/lightly-toasted/nix-config.git
synced 2025-10-04 07:25:40 +00:00
feat(nixvim): configure LSP completion and code actions
This commit is contained in:
parent
d887ce84e1
commit
959d504283
2 changed files with 35 additions and 5 deletions
|
@ -82,6 +82,12 @@
|
||||||
action = "<cmd>Telescope buffers<CR>";
|
action = "<cmd>Telescope buffers<CR>";
|
||||||
options.desc = "Telescope: List Buffers";
|
options.desc = "Telescope: List Buffers";
|
||||||
}
|
}
|
||||||
|
{
|
||||||
|
mode = ["n" "v"];
|
||||||
|
key = "<leader>ca";
|
||||||
|
action = "<cmd>lua vim.lsp.buf.code_action()<CR>";
|
||||||
|
options.desc = "LSP Code Action";
|
||||||
|
}
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,10 +2,34 @@
|
||||||
programs.nixvim.plugins.cmp = {
|
programs.nixvim.plugins.cmp = {
|
||||||
enable = true;
|
enable = true;
|
||||||
autoEnableSources = true;
|
autoEnableSources = true;
|
||||||
settings.sources = [
|
settings = {
|
||||||
{ name = "nvim_lsp"; }
|
sources = [
|
||||||
{ name = "path"; }
|
{ name = "nvim_lsp"; }
|
||||||
{ name = "buffer"; }
|
{ name = "path"; }
|
||||||
];
|
{ name = "buffer"; }
|
||||||
|
];
|
||||||
|
mapping = {
|
||||||
|
"<Tab>" = ''
|
||||||
|
cmp.mapping(function(fallback)
|
||||||
|
if cmp.visible() then
|
||||||
|
cmp.select_next_item()
|
||||||
|
else
|
||||||
|
fallback()
|
||||||
|
end
|
||||||
|
end, { "i", "s" })
|
||||||
|
'';
|
||||||
|
"<S-Tab>" = ''
|
||||||
|
cmp.mapping(function(fallback)
|
||||||
|
if cmp.visible() then
|
||||||
|
cmp.select_prev_item()
|
||||||
|
else
|
||||||
|
fallback()
|
||||||
|
end
|
||||||
|
end, { "i", "s" })
|
||||||
|
'';
|
||||||
|
"<C-Space>" = "cmp.mapping.complete()";
|
||||||
|
"<CR>" = "cmp.mapping.confirm({ select = true })";
|
||||||
|
};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue