diff options
Diffstat (limited to '.vimrc')
-rw-r--r-- | .vimrc | 21 |
1 files changed, 18 insertions, 3 deletions
@@ -236,15 +236,16 @@ nmap <leader>bq :bp <BAR> bd #<CR> colorscheme base16-default-dark +let g:ale_completion_enabled = 1 + " Load all plugins now. " Plugins need to be added to runtimepath before helptags can be generated. -packloadall " Load all of the helptags now, after plugins have been loaded. " All messages and errors will be ignored. -silent! helptags ALL +packloadall | silent! helptags ALL function! s:on_lsp_buffer_enabled() abort - setlocal omnifunc=lsp#complete + " setlocal omnifunc=lsp#complete setlocal signcolumn=yes if exists('+tagfunc') | setlocal tagfunc=lsp#tagfunc | endif nmap <buffer> gd <plug>(lsp-definition) @@ -282,6 +283,18 @@ if executable('solargraph') \ }) endif +function! SmartInsertCompletion() abort +" Use the default CTRL-N in completion menus +if pumvisible() + return "\<C-n>" +endif + +" Exit and re-enter insert mode, and use insert completion +return "\<C-c>a\<C-n>" +endfunction + +inoremap <silent> <C-n> <C-R>=SmartInsertCompletion()<CR> + inoremap <expr> <Tab> pumvisible() ? "\<C-n>" : "\<Tab>" inoremap <expr> <S-Tab> pumvisible() ? "\<C-p>" : "\<S-Tab>" inoremap <expr> <cr> pumvisible() ? asyncomplete#close_popup() : "\<cr>" @@ -290,3 +303,5 @@ let g:termdebug_popup = 0 let g:termdebug_wide = 163 vnoremap <leader>d :DB<cr> + +set omnifunc=ale#completion#OmniFunc |