plugins/completion: move to by-name

- Move nvim-cmp to plugins/cmp
- Move other completion plugins to plugins/by-name
This commit is contained in:
Matt Sturgeon 2024-09-05 02:36:41 +01:00
parent 3211a63306
commit ad85cd760e
No known key found for this signature in database
GPG key ID: 4F91844CED1A8299
36 changed files with 2 additions and 9 deletions

View file

@ -1,74 +0,0 @@
{ lib, helpers }:
with lib;
rec {
settingsOptions = import ./settings-options.nix { inherit lib helpers; };
settingsExample = {
snippet.expand = "function(args) require('luasnip').lsp_expand(args.body) end";
mapping.__raw = ''
cmp.mapping.preset.insert({
['<C-b>'] = cmp.mapping.scroll_docs(-4),
['<C-f>'] = cmp.mapping.scroll_docs(4),
['<C-Space>'] = cmp.mapping.complete(),
['<C-e>'] = cmp.mapping.abort(),
['<CR>'] = cmp.mapping.confirm({ select = true }),
})
'';
sources.__raw = ''
cmp.config.sources({
{ name = 'nvim_lsp' },
{ name = 'vsnip' },
-- { name = 'luasnip' },
-- { name = 'ultisnips' },
-- { name = 'snippy' },
}, {
{ name = 'buffer' },
})
'';
};
attrsOfOptions =
with types;
attrsOf (submodule {
freeformType = attrsOf anything;
options = settingsOptions;
});
filetype = mkOption {
type = attrsOfOptions;
default = { };
description = "Options provided to the `require('cmp').setup.filetype` function.";
example = {
python = {
sources = [ { name = "nvim_lsp"; } ];
};
};
};
cmdline = mkOption {
type = attrsOfOptions;
default = { };
description = "Options provided to the `require('cmp').setup.cmdline` function.";
example = {
"/" = {
mapping.__raw = "cmp.mapping.preset.cmdline()";
sources = [ { name = "buffer"; } ];
};
":" = {
mapping.__raw = "cmp.mapping.preset.cmdline()";
sources = [
{ name = "path"; }
{
name = "cmdline";
option = {
ignore_cmds = [
"Man"
"!"
];
};
}
];
};
};
};
}