-
Configure your [Neo]Vim to support Language Server Protocol -- I recommend (early 2020) coc.nvim.
-
Install ccls on your system.
-
Configure your LSP plugin in Vim to use
ccls
. In case ofcoc.nvim
, the configuration looks as follows:"languageserver": { "ccls": { "command": "ccls", "filetypes": [ "c", "cpp" ], "settings": {}, "rootPatterns": [ ".ccls", "compile_commands.json", ".vim/", ".git/", ".hg/" ], "initializationOptions": { "cache": { "directory": "/tmp/ccls" }, "highlight": { "lsRanges": true } }
-
Create a build folder and build the project using cmake:
$ mkdir build-vim $ cd build-vim $ cmake .. \ -G Ninja \ -DCMAKE_TOOLCHAIN_FILE=../cmake/GccArmNoneEabi.cmake \ -DPRINTER=MINI ... and other cmake flags $ ninja
-
Locate a
compile_commands.json
file (which was produced as part of the build) forccls
. By default,ccls
searches in project's root directory, butninja
produces it in the build folder. There are two options:- Update
ccls
config to letccls
know, that it should search for it in thebuild-vim
subfolder, or - make a symbolic link in project's root directory:
ln -s build-vim/compile_commands.json
.
- Update
-
Install some spell checker (optional but recommended).
-
Get to work! 💪
This repository has been archived by the owner on Feb 4, 2023. It is now read-only.