nix-community.nixvim/plugins/cmp/options/default.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

74 lines
1.8 KiB
Nix
Raw Normal View History

2024-10-06 10:05:31 -05:00
{ lib }:
rec {
2024-10-06 10:05:31 -05:00
settingsOptions = import ./settings-options.nix { inherit lib; };
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 =
2024-10-06 09:57:31 -05:00
with lib.types;
attrsOf (submodule {
freeformType = attrsOf anything;
options = settingsOptions;
});
2024-10-06 09:57:31 -05:00
filetype = lib.mkOption {
type = attrsOfOptions;
default = { };
description = "Options provided to the `require('cmp').setup.filetype` function.";
example = {
python = {
sources = [ { name = "nvim_lsp"; } ];
};
};
};
2024-10-06 09:57:31 -05:00
cmdline = lib.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"
"!"
];
};
}
];
};
};
};
}