-
Notifications
You must be signed in to change notification settings - Fork 262
vim lsc
Martino Pilia edited this page Apr 26, 2019
·
2 revisions
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).