From 120fcdf7450ae9751569ebac90a759cd4a5c1f2d Mon Sep 17 00:00:00 2001 From: Martino Pilia Date: Wed, 24 Apr 2019 20:38:52 +0200 Subject: [PATCH] Add vim-lsc --- Editor-Configuration.md | 3 ++- _Sidebar.md | 1 + vim-lsc.md | 30 ++++++++++++++++++++++++++++++ 3 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 vim-lsc.md diff --git a/Editor-Configuration.md b/Editor-Configuration.md index 5c1188d..d601c3c 100644 --- a/Editor-Configuration.md +++ b/Editor-Configuration.md @@ -13,7 +13,7 @@ - Atom IDE: [atom-ide-ccls] - Emacs: [eglot] [emacs-ccls] -- (Neo)Vim: [coc.nvim] [ale] [LanguageClient-neovim] [vim-lsp] +- (Neo)Vim: [coc.nvim] [ale] [LanguageClient-neovim] [vim-lsp] [vim-lsc] - VSCode: [vscode-ccls] - Monaco Editor: [monaco-editor] @@ -30,5 +30,6 @@ https://github.com/MaskRay/ccls/wiki/FAQ#definitions and following sections. [LanguageClient-neovim]: https://github.com/autozimu/LanguageClient-neovim [lsp-mode]: https://github.com/emacs-lsp/lsp-mode [vim-lsp]: https://github.com/prabirshrestha/vim-lsp +[vim-lsc]: https://github.com/natebosch/vim-lsc [vscode-ccls]: https://github.com/MaskRay/vscode-ccls [monaco-editor]: https://github.com/MaskRay/ccls/wiki/Monaco-Editor \ No newline at end of file diff --git a/_Sidebar.md b/_Sidebar.md index 9daac49..53a328c 100644 --- a/_Sidebar.md +++ b/_Sidebar.md @@ -10,6 +10,7 @@ + [[coc.nvim]] + [[LanguageClient-neovim]] + [[vim-lsp]] + + [[vim-lsc]] - [[Visual Studio Code]] - [[Monaco Editor | https://github.com/MaskRay/ccls/wiki/Monaco-Editor]] * [[Project Setup]] diff --git a/vim-lsc.md b/vim-lsc.md new file mode 100644 index 0000000..09b5ba0 --- /dev/null +++ b/vim-lsc.md @@ -0,0 +1,30 @@ +Install [vim-lsc](https://github.com/natebosch/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): + +```viml +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](https://github.com/MaskRay/ccls/wiki/compile_commands.json) 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.: + +```viml +let g:lsc_auto_map = { +\ 'GoToDefinition': '', +\ 'FindReferences': '', +\} +``` + +(optionally add `'defaults': v:true` to keep default values for other mappings that are not redefined). \ No newline at end of file