Skip to content
This repository has been archived by the owner on Jul 30, 2020. It is now read-only.
VperuS edited this page Oct 6, 2018 · 12 revisions

Install LanguageClient-neovim using vim-plug

Config file for neovim/vim

For vim user, the config file is ~/.vimrc for neovim user, use ~/.config/nvim/init.vim

" LanguageClient-neovim
call plug#begin('~/.local/share/nvim/plugged')
Plug 'autozimu/LanguageClient-neovim', {
    \ 'branch': 'next',
    \ 'do': 'bash install.sh',
    \ }

" Multi-entry selection UI. FZF
Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' }
Plug 'junegunn/fzf.vim'

call plug#end()

bash

nvim +PlugInstall +UpdateRemotePlugins +qa

/home/YOUR_USERNAME/.config/nvim/settings.json

{
  "initializationOptions": {
    "cacheDirectory": "/tmp/cquery"
  }
}

/home/YOUR_USERNAME/.config/nvim/init.vim

let g:LanguageClient_serverCommands = {
    \ 'cpp': ['cquery', '--log-file=/tmp/cq.log'],
    \ 'c': ['cquery', '--log-file=/tmp/cq.log'],
    \ }

let g:LanguageClient_loadSettings = 1 " Use an absolute configuration path if you want system-wide settings
let g:LanguageClient_settingsPath = '/home/YOUR_USERNAME/.config/nvim/settings.json'
set completefunc=LanguageClient#complete
set formatexpr=LanguageClient_textDocument_rangeFormatting()

nnoremap <silent> gh :call LanguageClient#textDocument_hover()<CR>
nnoremap <silent> gd :call LanguageClient#textDocument_definition()<CR>
nnoremap <silent> gr :call LanguageClient#textDocument_references()<CR>
nnoremap <silent> gs :call LanguageClient#textDocument_documentSymbol()<CR>
nnoremap <silent> <F2> :call LanguageClient#textDocument_rename()<CR>

Your project directory need to contain compile_commands.json

Produce compile_commands.json