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

Build and Install Cquery

$ git clone https://github.com/jacobdufault/cquery --single-branch --depth=1
$ cd cquery
$ git submodule update --init
$ ./waf configure
$ ./waf build
$ sudo ./waf install

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', '--language-server', '--log-file=/tmp/cq.log'],
    \ 'c': ['cquery', '--language-server', '--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