dotfiles/home/modules/tui/neovim/completion.nix

58 lines
1.5 KiB
Nix
Raw Normal View History

2024-12-05 03:11:13 +00:00
{
programs.nixvim = {
2024-12-20 01:30:06 +00:00
opts.completeopt = [ "menu" "menuone" "noselect" ];
2024-12-05 03:11:13 +00:00
plugins = {
luasnip.enable = true;
lspkind = {
enable = true;
cmp = {
enable = true;
menu = {
nvim_lsp = "[LSP]";
nvim_lua = "[api]";
path = "[path]";
luasnip = "[snip]";
buffer = "[buffer]";
nixpkgs_maintainers = "[nixpkgs]";
};
};
};
cmp = {
enable = true;
settings = {
2024-12-20 01:30:06 +00:00
snippet.expand =
"function(args) require('luasnip').lsp_expand(args.body) end";
2024-12-05 03:11:13 +00:00
mapping = {
"<C-d>" = "cmp.mapping.scroll_docs(-4)";
"<C-f>" = "cmp.mapping.scroll_docs(4)";
"<C-Space>" = "cmp.mapping.complete()";
"<C-e>" = "cmp.mapping.close()";
"<Tab>" = "cmp.mapping(cmp.mapping.select_next_item(), {'i', 's'})";
2024-12-20 01:30:06 +00:00
"<S-Tab>" =
"cmp.mapping(cmp.mapping.select_prev_item(), {'i', 's'})";
2024-12-05 03:11:13 +00:00
"<CR>" = "cmp.mapping.confirm({ select = true })";
};
sources = [
2024-12-20 01:30:06 +00:00
{ name = "path"; }
{ name = "nvim_lsp"; }
{ name = "luasnip"; }
{ name = "nixpkgs_maintainers"; }
2024-12-05 03:11:13 +00:00
{
name = "buffer";
# words from other open buffers can also be suggested
option.get_bufnrs.__raw = "vim.api.nvim_list_bufs";
}
];
};
};
};
};
2024-12-20 01:30:06 +00:00
}