Skip to content
This repository has been archived by the owner on Jul 30, 2020. It is now read-only.
Luke Bayes edited this page Mar 8, 2020 · 7 revisions

There are three choices of Vim plugins for language service protocol (LSP clients. Follow the respective link for information about how to register cquery server with one of them:

Below are further customization examples for each of them.

LanguageClient-neovim

nn <silent> <M-.> :call LanguageClient_textDocument_definition()<cr>
nn <silent> <M-,> :call LanguageClient_textDocument_references()<cr>
nn <f2> :call LanguageClient_textDocument_rename()<cr>
nn <leader>ji :Denite documentSymbol<cr>
nn <leader>jI :Denite workspaceSymbol<cr>

workspace/symbol

Search for workspace symbols approximately.

nn ,la :call LanguageClient_workspace_symbol({'query':input('workspace/symbol ')})<cr>

Send textDocument/hover when cursor moves.

augroup LanguageClient_config
  au!
  au BufEnter * let b:Plugin_LanguageClient_started = 0
  au User LanguageClientStarted setl signcolumn=yes
  au User LanguageClientStarted let b:Plugin_LanguageClient_started = 1
  au User LanguageClientStopped setl signcolumn=auto
  au User LanguageClientStopped let b:Plugin_LanguageClient_stopped = 0
  au CursorMoved * if b:Plugin_LanguageClient_started | call LanguageClient_textDocument_hover() | endif
augroup END

vim-lsp

Key bindings

nn <silent> <M-d> :LspDefinition<cr>
nn <silent> <M-r> :LspReferences<cr>
nn <silent> <M-=> :LspDocumentFormat<cr>
nn <f2> :LspRename<cr>