Modernize vim completion.

This commit is contained in:
Gabriel Ebner 2024-09-29 03:52:21 +00:00
parent a6ecff72f0
commit 1962564419
2 changed files with 39 additions and 27 deletions

3
bashrc

@ -37,3 +37,6 @@ for fn in /usr/share/fzf/shell/key-bindings.bash /usr/share/fzf/key-bindings.bas
break break
fi fi
done done
# add Pulumi to the PATH
export PATH=$PATH:/home/gebner/.pulumi/bin

63
vimrc

@ -112,7 +112,12 @@ Plug 'nvim-lua/plenary.nvim'
" Plug 'nvim-treesitter/nvim-treesitter-textobjects' " Plug 'nvim-treesitter/nvim-treesitter-textobjects'
" Plug 'nvim-treesitter/playground' " Plug 'nvim-treesitter/playground'
Plug 'hrsh7th/nvim-compe' Plug 'hrsh7th/cmp-nvim-lsp'
Plug 'hrsh7th/cmp-buffer'
Plug 'hrsh7th/cmp-path'
Plug 'hrsh7th/cmp-cmdline'
Plug 'hrsh7th/nvim-cmp'
if isdirectory(expand('~/lean.nvim')) if isdirectory(expand('~/lean.nvim'))
Plug '~/lean.nvim' Plug '~/lean.nvim'
else else
@ -177,7 +182,7 @@ let g:jellybeans_overrides = {
" colors jellybeans " colors jellybeans
" endif " endif
" colors monokai-nightasty " colors monokai-nightasty
colors default colors vim
au syntax java setl ts=4 sts=4 sw=4 au syntax java setl ts=4 sts=4 sw=4
@ -265,27 +270,37 @@ lua <<EOF
-- }, -- },
-- } -- }
require'compe'.setup { local cmp = require'cmp'
cmp.setup {
enabled = true; enabled = true;
autocomplete = false; -- autocomplete = false;
debug = false; -- debug = false;
min_length = 1; -- min_length = 1;
preselect = 'enable'; -- preselect = 'enable';
throttle_time = 80; -- throttle_time = 80;
source_timeout = 200; -- source_timeout = 200;
incomplete_delay = 400; -- incomplete_delay = 400;
max_abbr_width = 100; -- max_abbr_width = 100;
max_kind_width = 100; -- max_kind_width = 100;
max_menu_width = 100; -- max_menu_width = 100;
documentation = true; -- documentation = true;
source = { mapping = cmp.mapping.preset.insert({
path = true; ['<C-b>'] = cmp.mapping.scroll_docs(-4),
buffer = true; ['<C-f>'] = cmp.mapping.scroll_docs(4),
calc = true; ['<C-Space>'] = cmp.mapping.complete(),
nvim_lsp = true; ['<C-e>'] = cmp.mapping.abort(),
-- emoji = true; ['<CR>'] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items.
}; });
sources = cmp.config.sources({
{ name = 'nvim_lsp' },
-- { name = 'vsnip' }, -- For vsnip users.
-- { name = 'luasnip' }, -- For luasnip users.
-- { name = 'ultisnips' }, -- For ultisnips users.
-- { name = 'snippy' }, -- For snippy users.
}, {
{ name = 'buffer' },
});
} }
vim.lsp.handlers["textDocument/publishDiagnostics"] = vim.lsp.with( vim.lsp.handlers["textDocument/publishDiagnostics"] = vim.lsp.with(
@ -365,12 +380,6 @@ hi Pmenu ctermfg=White ctermbg=Black guifg=#ffffff guibg=#000000
au syntax leaninfo setl scl=no au syntax leaninfo setl scl=no
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 })
nnoremap gD <Cmd>lua vim.lsp.buf.declaration()<CR> nnoremap gD <Cmd>lua vim.lsp.buf.declaration()<CR>
nnoremap gd <Cmd>lua vim.lsp.buf.definition()<CR> nnoremap gd <Cmd>lua vim.lsp.buf.definition()<CR>
nnoremap K <Cmd>lua vim.lsp.buf.hover()<CR> nnoremap K <Cmd>lua vim.lsp.buf.hover()<CR>