mirror of
https://github.com/nix-community/nixvim.git
synced 2025-07-20 10:45:51 +02:00
plugins/nvim-cmp: refactoring (init filetype and cmdline options)
This commit is contained in:
parent
22b587f3dc
commit
a61c8fbc3d
26 changed files with 1166 additions and 948 deletions
82
plugins/completion/cmp/options/default.nix
Normal file
82
plugins/completion/cmp/options/default.nix
Normal file
|
@ -0,0 +1,82 @@
|
|||
{
|
||||
lib,
|
||||
helpers,
|
||||
}:
|
||||
with lib; rec {
|
||||
settingsOptions = import ./settings-options.nix {inherit lib helpers;};
|
||||
|
||||
settingsExample = {
|
||||
snippet.expand = "luasnip";
|
||||
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 for `cmp.filetype()`.";
|
||||
example = {
|
||||
python = {
|
||||
sources = [
|
||||
{name = "nvim_lsp";}
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
cmdline = mkOption {
|
||||
type = attrsOfOptions;
|
||||
default = {};
|
||||
description = "Options for `cmp.cmdline()`.";
|
||||
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" "!"];
|
||||
};
|
||||
}
|
||||
]
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue