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

Neovim

Need vim-plug

/home/YOUR_USERNAME/.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>

In your Project Directory NEED compile_commands.json

Produce compile_commands.json

bear make #If you like Makefile

or

bear gcc x.c -o x

or any other