diff options
author | Adrian Kummerlaender | 2019-03-06 15:35:07 +0100 |
---|---|---|
committer | Adrian Kummerlaender | 2019-03-06 15:35:07 +0100 |
commit | e324de87dad9773f02d4da0aea64d1c394c2226f (patch) | |
tree | 7f9e262a07c45fb198ac7e4dea1954ec61693f33 | |
parent | b6544120a820700785ef0d05b462df2e4bb17c53 (diff) | |
download | pkgs-e324de87dad9773f02d4da0aea64d1c394c2226f.tar pkgs-e324de87dad9773f02d4da0aea64d1c394c2226f.tar.gz pkgs-e324de87dad9773f02d4da0aea64d1c394c2226f.tar.bz2 pkgs-e324de87dad9773f02d4da0aea64d1c394c2226f.tar.lz pkgs-e324de87dad9773f02d4da0aea64d1c394c2226f.tar.xz pkgs-e324de87dad9773f02d4da0aea64d1c394c2226f.tar.zst pkgs-e324de87dad9773f02d4da0aea64d1c394c2226f.zip |
Improve omnicompletion bindings
-rw-r--r-- | pkgs/custom-neovim/asset/rc.vim | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/pkgs/custom-neovim/asset/rc.vim b/pkgs/custom-neovim/asset/rc.vim index 202b1ad..31eb27a 100644 --- a/pkgs/custom-neovim/asset/rc.vim +++ b/pkgs/custom-neovim/asset/rc.vim @@ -145,10 +145,23 @@ if executable('cquery') nnoremap <silent> gt :LspTypeDefinition<CR> nnoremap <silent> gi :LspImplementation<CR> nnoremap <silent> gr :LspReferences<CR> - - nmap <c-t> :LspWorkspaceSymbol<CR> - nmap <a-t> :LspDocumentSymbol<CR> + nnoremap <c-t> :LspWorkspaceSymbol<CR> + nnoremap <a-t> :LspDocumentSymbol<CR> autocmd FileType cpp setlocal omnifunc=lsp#complete + set completeopt=longest,menuone,preview + " use enter to select completion item + inoremap <expr> <CR> pumvisible() ? "\<C-y>" : "\<C-g>u\<CR>" + " improve popup and selection behavior + inoremap <expr> <C-n> pumvisible() ? '<C-n>' : + \ '<C-n><C-r>=pumvisible() ? "\<lt>Down>" : ""<CR>' + inoremap <expr> <M-,> pumvisible() ? '<C-n>' : + \ '<C-x><C-o><C-n><C-p><C-r>=pumvisible() ? "\<lt>Down>" : ""<CR>' + " trigger omnicompletion using <C-m> (compared to <C-n> for plain completion) inoremap <C-m> <C-x><C-o> + + " close documentation buffer after selecting a completion item + autocmd CompleteDone * silent! pclose + " close quickfix buffer after selection + autocmd FileType qf nnoremap <buffer> <CR> <CR>:cclose<CR> endif |