nixvimConfigs/fiesta/setups/completion: update to new module

This commit is contained in:
Gabriel Arazas 2024-03-07 18:44:48 +08:00
parent 0c13466cb5
commit 9f767a6b00
No known key found for this signature in database
GPG Key ID: ADE0C41DAB221FCC

View File

@ -10,51 +10,26 @@ in
config = lib.mkIf cfg.enable (lib.mkMerge [ config = lib.mkIf cfg.enable (lib.mkMerge [
{ {
plugins.nvim-cmp = { plugins.cmp = {
enable = true; enable = true;
autoEnableSources = true; autoEnableSources = true;
mapping = { settings.mapping = {
"<CR>" = "cmp.mapping.confirm({ select = true })"; "<CR>" = "cmp.mapping.confirm({ select = true })";
"<C-Space>" = "cmp.mapping.complete()"; "<C-Space>" = "cmp.mapping.complete()";
"<C-d>" = "cmp.mapping.scroll_docs(-4)"; "<C-d>" = "cmp.mapping.scroll_docs(-4)";
"<C-u>" = "cmp.mapping.scroll_docs(4)"; "<C-u>" = "cmp.mapping.scroll_docs(4)";
"<C-g>" = "cmp.mapping.close()"; "<C-g>" = "cmp.mapping.close()";
"<C-n>" = "cmp.mapping.select_next_item()";
"<C-n>" = { "<C-p>" = "cmp.mapping.select_prev_item()";
action = "cmp.mapping.select_next_item()"; "<Tab>" = "cmp.mapping.select_next_item()";
modes = [ "i" "s" ]; "<S-Tab>" = "cmp.mapping.select_prev_item()";
};
"<C-p>" = {
action = "cmp.mapping.select_prev_item()";
modes = [ "i" "s" ];
}; };
"<Tab>" = { settings.sources = [
action = "cmp.mapping.select_next_item()"; { name = "nvim_lsp"; }
modes = [ "i" "s" ]; { name = "path"; }
}; { name = "buffer"; }
"<S-Tab>" = {
action = "cmp.mapping.select_prev_item()";
modes = [ "i" "s" ];
};
};
sources = [
{
name = "nvim_lsp";
groupIndex = 1;
}
{
name = "path";
groupIndex = 3;
}
{
name = "buffer";
groupIndex = 4;
}
]; ];
}; };
@ -70,16 +45,15 @@ in
}) })
(lib.mkIf nixvimCfg.setups.snippets.enable { (lib.mkIf nixvimCfg.setups.snippets.enable {
plugins.nvim-cmp.extraOptions.snippet.expand = helpers.mkRaw '' plugins.cmp.settings = {
snippet.expand = ''
function(args) function(args)
require('luasnip').lsp_expand(args.body) require('luasnip').lsp_expand(args.body)
end end
''; '';
plugins.nvim-cmp.sources = [{ sources = [{ name = "luasnip"; }];
name = "luasnip"; };
groupIndex = 2;
}];
plugins.cmp_luasnip.enable = true; plugins.cmp_luasnip.enable = true;
}) })