feat: refactor and separate LSP/language configurations

This commit is contained in:
NotAShelf 2023-04-17 23:27:27 +03:00
commit 6b512f132a
No known key found for this signature in database
GPG key ID: F0D14CCB5ED5AA22
30 changed files with 1266 additions and 522 deletions

View file

@ -1,4 +1,5 @@
{
pkgs,
lib,
config,
...
@ -6,15 +7,22 @@
with lib;
with builtins; let
cfg = config.vim.autocomplete;
builtSources =
concatMapStringsSep "\n" (x: "{ name = '${x}'},") cfg.sources;
in {
config = mkIf cfg.enable {
vim.startPlugins = [
"vim-vsnip"
"nvim-cmp"
"cmp-buffer"
"cmp-vsnip"
"cmp-path"
"cmp-treesitter"
];
vim.autocomplete.sources = [
"nvim-cmp"
"vsnip"
"buffer"
"path"
];
vim.luaConfigRC.completion = mkIf (cfg.type == "nvim-cmp") (nvim.dag.entryAnywhere ''
@ -35,12 +43,7 @@ in {
end,
},
sources = {
${optionalString (config.vim.lsp.enable) "{ name = 'nvim_lsp' },"}
${optionalString (config.vim.lsp.rust.enable) "{ name = 'crates' },"}
{ name = 'vsnip' },
{ name = 'treesitter' },
{ name = 'path' },
{ name = 'buffer' },
${builtSources}
},
mapping = {
['<C-d>'] = cmp.mapping(cmp.mapping.scroll_docs(-4), { 'i', 'c' }),