-
Notifications
You must be signed in to change notification settings - Fork 271
vim mucomplete with cpp
Lifepillar edited this page Mar 7, 2019
·
2 revisions
Add LanguageClient-neovim settings:
let g:LanguageClient_serverCommands = {
\ 'cpp': ['/usr/local/bin/clangd']
\ }
" Alternatively, with cquery:
"let g:LanguageClient_serverCommands = {
" \ 'cpp': ['/usr/local/bin/cquery',
" \ '--init={"cacheDirectory":"/tmp/cquery/"}'],
" \ 'c': ['/usr/local/bin/cquery',
" \ '--init={"cacheDirectory":"/tmp/cquery/"}']
" \ }
if !has('nvim')
packadd nvim-yarp
packadd vim-hug-neovim-rpc
endif
packadd LanguageClient-neovim
Trigger completion using vim-mucomplete:
set complete=.,w,b,u,k
set completeopt=menuone,noselect
let g:mucomplete#enable_auto_at_startup = 1
let g:mucomplete#chains = {}
let g:mucomplete#chains.default = ['omni', 'c-n', 'path', 'tags', 'dict']
let s:cpp_cond = { t -> t =~# '\%(->\|::\|\.\)$' }
let g:mucomplete#can_complete = {}
let g:mucomplete#can_complete.cpp = { 'omni': s:cpp_cond }
packadd vim-mucomplete
If it seems that autocompletion is not working correctly under all circumstances (e.g., after .
or ->
), add this to your configuration:
let g:mucomplete#completion_delay = 100
let g:mucomplete#reopen_immediately = 0
This requires Vim 8.0.0283 compiled with +timers
.