vim: Replace nvim-compe with nvim-cmp

This commit is contained in:
Geoffrey Frogeye 2024-01-09 20:00:12 +01:00
parent aeccc22857
commit d325eb2d27
Signed by: geoffrey
GPG key ID: C72403E7F82E6AD8
5 changed files with 33 additions and 93 deletions

View file

@ -78,6 +78,34 @@ in
# Tabline
barbar.enable = true;
# Completion
nvim-cmp = {
enable = true;
mapping = { # Proposed example, since there's no default
"<C-Space>" = "cmp.mapping.complete()";
"<C-d>" = "cmp.mapping.scroll_docs(-4)";
"<C-e>" = "cmp.mapping.close()";
"<C-f>" = "cmp.mapping.scroll_docs(4)";
"<CR>" = "cmp.mapping.confirm({ select = true })";
"<S-Tab>" = {
action = "cmp.mapping.select_prev_item()";
modes = [ "i" "s" ];
};
"<Tab>" = {
action = "cmp.mapping.select_next_item()";
modes = [ "i" "s" ];
};
};
sources = [ # Respective plugins will get installed automatically
{ name = "buffer"; }
{ name = "calc"; }
{ name = "nvim_lsp"; }
{ name = "path"; }
{ name = "vsnip"; }
];
};
lspkind.enable = true; # Add icons to LSP completions
# Go to whatever
telescope = {
enable = true;
@ -164,16 +192,12 @@ in
yamlls.enable = true; # YAML
# TODO Check out none-ls
};
onAttach = ''
vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc')
''; # Seems needed for auto-completion with nvim-compe
};
nvim-lightbulb = {
# Shows a lightbulb whenever a codeAction is available under the cursor
enable = true;
autocmd.enabled = true;
};
lspkind.enable = true; # Add icons to LSP completions
# Treesitter
treesitter = {
@ -231,13 +255,10 @@ in
lsp_signature-nvim # Show argument definition when typing a function
# Snippets
vim-vsnip
vim-vsnip
vim-vsnip-integ
friendly-snippets
# Auto-completion
nvim-compe
# TODO Archived. Maybe use nvim-cmp and plugins instead?
# TODO luasnip seems to be in Lua and more integrated with Nix.
# Git
fugitive-gitlab-vim # Open files in GitLab
@ -257,7 +278,6 @@ in
./feline.lua
./symbols-outline-nvim.lua
./lsp_signature-nvim.lua
./nvim-compe.lua
];
extraConfigVim = ''
" GENERAL
@ -272,16 +292,6 @@ in
" vim-gutentags
let g:gutentags_cache_dir = expand('~/.cache/nvim/tags')
" nvim-compe
" Copy-pasted because I couldn't be bothered
set completeopt=menuone,noselect
inoremap <silent><expr> <C-Space> compe#complete()
inoremap <silent><expr> <CR> compe#confirm('<CR>')
inoremap <silent><expr> <C-e> compe#close('<C-e>')
inoremap <silent><expr> <C-f> compe#scroll({ 'delta': +4 })
inoremap <silent><expr> <C-d> compe#scroll({ 'delta': -4 })
'' + lib.optionalString config.frogeye.extra ''
" languagetool
let g:languagetool_cmd = "${pkgs.languagetool}/bin/languagetool-commandline"