mirror of
https://github.com/NotAShelf/nvf.git
synced 2025-09-05 18:01:32 +00:00
feat: refactor and separate LSP/language configurations
This commit is contained in:
parent
7a71f06763
commit
6b512f132a
30 changed files with 1266 additions and 522 deletions
|
@ -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' }),
|
||||
|
|
|
@ -1,16 +1,21 @@
|
|||
{
|
||||
pkgs,
|
||||
lib,
|
||||
config,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
with builtins; {
|
||||
with builtins; let
|
||||
cfg = config.vim.autocomplete;
|
||||
builtSources =
|
||||
concatMapStringsSep "\n" (x: "{ name = '${x}'},") cfg.sources;
|
||||
in {
|
||||
options.vim = {
|
||||
autocomplete = {
|
||||
enable = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
description = "Enable autocomplete via nvim-cmp";
|
||||
description = "enable autocomplete";
|
||||
};
|
||||
|
||||
type = mkOption {
|
||||
|
@ -18,6 +23,12 @@ with builtins; {
|
|||
default = "nvim-cmp";
|
||||
description = "Set the autocomplete plugin. Options: [nvim-cmp]";
|
||||
};
|
||||
|
||||
sources = mkOption {
|
||||
description = "List of source names for nvim-cmp";
|
||||
type = with types; listOf str;
|
||||
default = [];
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue