2024-12-01 16:54:44 +01:00
|
|
|
{
|
|
|
|
lib,
|
|
|
|
config,
|
|
|
|
...
|
|
|
|
}:
|
|
|
|
|
|
|
|
lib.mkIf (lib.elem "nvim::cmp" config.machine.pkgs) {
|
|
|
|
programs.nvim-lazy.lazyPlugins = [
|
|
|
|
# Autocompletion
|
|
|
|
{
|
|
|
|
dir = vPlug: vPlug.nvim-cmp;
|
|
|
|
event = [ "InsertEnter" ];
|
|
|
|
dependencies = (
|
|
|
|
vPlug: with vPlug; [
|
|
|
|
luasnip
|
|
|
|
]
|
|
|
|
);
|
|
|
|
config = # lua
|
|
|
|
''
|
|
|
|
function()
|
|
|
|
local cmp = require('cmp')
|
|
|
|
|
|
|
|
cmp.setup({
|
|
|
|
${
|
|
|
|
lib.optionalString (lib.elem "nvim::lsp" config.machine.pkgs) # lua
|
2024-12-14 21:44:39 +01:00
|
|
|
''sources = { { name = 'nvim_lsp' }, },''
|
2024-12-01 16:54:44 +01:00
|
|
|
}
|
|
|
|
mapping = cmp.mapping.preset.insert({
|
|
|
|
['<C-Space>'] = cmp.mapping.complete(),
|
|
|
|
['<CR>'] = cmp.mapping.confirm({ select = true }),
|
|
|
|
['<C-u>'] = cmp.mapping.scroll_docs(-4),
|
|
|
|
['<C-d>'] = cmp.mapping.scroll_docs(4),
|
|
|
|
})
|
|
|
|
})
|
|
|
|
end
|
|
|
|
'';
|
|
|
|
}
|
|
|
|
|
|
|
|
{
|
|
|
|
dir = vPlug: vPlug.luasnip;
|
|
|
|
lazy = true;
|
|
|
|
}
|
|
|
|
];
|
|
|
|
}
|