-
Notifications
You must be signed in to change notification settings - Fork 271
Recommended Settings
LanguageClient-neovim
has multiple options for the completion management:
For best experience, it is advised to use deoplete
. This is one of the most
advanced completion manager which is very flexible and has numerous nice-to-have
features such as snippets integration (if you are a
UltiSnips user please proceed to
UltiSnips Integration).
You can install it via
if has('nvim')
Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' }
else
Plug 'Shougo/deoplete.nvim'
Plug 'roxma/nvim-yarp'
Plug 'roxma/vim-hug-neovim-rpc'
endif
let g:deoplete#enable_at_startup = 1
Also, by default LanguageClient-neovim
comes without key bindings. Since it is
easier to use key bindings for the source code navigation, it is advised to set up
a custom set of shortcuts. Suggested way of a consistent setup with the <leader> key:
function SetLSPShortcuts()
nnoremap <leader>ld :call LanguageClient#textDocument_definition()<CR>
nnoremap <leader>lr :call LanguageClient#textDocument_rename()<CR>
nnoremap <leader>lf :call LanguageClient#textDocument_formatting()<CR>
nnoremap <leader>lt :call LanguageClient#textDocument_typeDefinition()<CR>
nnoremap <leader>lx :call LanguageClient#textDocument_references()<CR>
nnoremap <leader>la :call LanguageClient_workspace_applyEdit()<CR>
nnoremap <leader>lc :call LanguageClient#textDocument_completion()<CR>
nnoremap <leader>lh :call LanguageClient#textDocument_hover()<CR>
nnoremap <leader>ls :call LanguageClient_textDocument_documentSymbol()<CR>
nnoremap <leader>lm :call LanguageClient_contextMenu()<CR>
endfunction()
augroup LSP
autocmd!
autocmd FileType cpp,c call SetLSPShortcuts()
augroup END
This will ensure that LSP shortcuts are enabled only for source files in C++ or
C. If you use other language servers for LanguageClient-neovim
, just add
more filetypes to the autocmd
.
Another great addition to the setup is FZF
integration. It will enable user to use fuzzy matching for something like
searching through workspace or document symbols. For FZF
,
LanguageClient-neovim
will take care of the configuration. All user has to
do is to install the plugin:
Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' }
Plug 'junegunn/fzf.vim'
echodoc can handle the function signatures displaying:
Plug 'Shougo/echodoc.vim'
set cmdheight=2
let g:echodoc#enable_at_startup = 1
let g:echodoc#type = 'signature'
signcolumn
will appear each time Clangd sends a warning or
provides a diagnostic and the text will be shifted by one column each time
signcolumn
is triggered. To prevent this shift and always show the
signcolumn
, use
" Always draw the signcolumn.
set signcolumn=yes
For documentation, see LanguageClient.txt
or simply call :help LanguageClient
.