Patrick Michl 28d8213ebc
add config
2024-11-05 13:01:15 +01:00

117 lines
2.7 KiB
Nix

{
plugins = {
cmp-emoji.enable = true;
cmp-nvim-lsp.enable = true;
cmp-buffer.enable = true;
cmp-path.enable = true;
cmp_luasnip.enable = true;
cmp-cmdline.enable = false;
cmp = {
enable = true;
settings = {
autoEnableSources = true;
experimental = {ghost_text = false;};
performance = {
debounce = 60;
fetchingTimeout = 200;
maxViewEntries = 30;
};
snippet = {expand = "luasnip";};
formatting = {fields = ["kind" "abbr" "menu"];};
sources = [
{name = "git";}
{name = "nvim_lsp";}
{name = "emoji";}
{
name = "buffer"; # text within current buffer
option.get_bufnrs.__raw = "vim.api.nvim_list_bufs";
keywordLength = 3;
}
{
name = "path"; # file system paths
keywordLength = 3;
}
{
name = "luasnip"; # snippets
keywordLength = 3;
}
];
window = {
completion = {border = "solid";};
documentation = {border = "solid";};
};
mapping = {
"<C-Tab>" =
/*
lua
*/
"cmp.mapping(cmp.mapping.select_next_item(), {'i', 's'})";
"<Down>" =
/*
lua
*/
"cmp.mapping.select_next_item()";
"<Up>" =
/*
lua
*/
"cmp.mapping.select_prev_item()";
"<C-e>" =
/*
lua
*/
"cmp.mapping.abort()";
"<C-b>" =
/*
lua
*/
"cmp.mapping.scroll_docs(-4)";
"<C-f>" =
/*
lua
*/
"cmp.mapping.scroll_docs(4)";
"<C-Space>" =
/*
lua
*/
"cmp.mapping.complete()";
"<CR>" =
/*
lua
*/
"cmp.mapping.confirm({ behavior = cmp.ConfirmBehavior.Replace, select = true })";
"<TAB>" =
/*
lua
*/
''
function(fallback)
if cmp.visible() then
cmp.select_next_item()
else
fallback()
end
end
'';
"<S-TAB>" =
/*
lua
*/
''
function(fallback)
if cmp.visible() then
cmp.select_prev_item()
else
fallback()
end
end
'';
};
};
};
};
}