mirror of
https://github.com/MaskRay/ccls.git
synced 2024-11-21 15:15:07 +00:00
Page:
vim lsc
2
vim lsc
Martino Pilia edited this page 2019-04-26 11:41:08 +02:00
Install vim-lsc according to the instructions in its README.
Configure ccls as the language server (example for cpp
, do similarly for other filetypes, as needed):
let g:lsc_server_commands = {
\ 'cpp': {
\ 'command': 'ccls',
\ 'message_hooks': {
\ 'initialize': {
\ 'initializationOptions': {'cache': {'directory': '/tmp/ccls/cache'}},
\ 'rootUri': {m, p -> lsc#uri#documentUri(fnamemodify(findfile('compile_commands.json', expand('%:p') . ';'), ':p:h'))}
\ },
\ },
\ },
\}
If the compilation database is correctly set, then things should work (e.g. reference highlight of the symbol under the cursor should be visible). See |lsc-commands|
for the list of all available commands.
Default mappings are provided out-of-the-box (see |lsc-default-map|
). To set custom mappings, change the values in |g:lsc_auto_map|
, e.g.:
let g:lsc_auto_map = {
\ 'GoToDefinition': '<M-d>',
\ 'FindReferences': '<M-r>',
\}
(optionally add 'defaults': v:true
to keep default values for other mappings that are not redefined).