Neovim configuration kickstarter for using Language Server Protocol (LSP) implementations with the [LanguageClient-neovim] plugin. With a primary focus on C/C++ development and clangd
See official documentation on the LLVM website
The essential bits are repeated here for convenience:
cat > /etc/apt/sources.list.d/llvm.list << EOF
deb http://apt.llvm.org/unstable/ llvm-toolchain main
deb-src http://apt.llvm.org/unstable/ llvm-toolchain main
# 5.0
deb http://apt.llvm.org/unstable/ llvm-toolchain-5.0 main
deb-src http://apt.llvm.org/unstable/ llvm-toolchain-5.0 main
# 6.0
deb http://apt.llvm.org/unstable/ llvm-toolchain-6.0 main
deb-src http://apt.llvm.org/unstable/ llvm-toolchain-6.0 main
EOF
# Fingerprint: 6084 F3CF 814B 57C1 CF12 EFD5 15CF 4D18 AF4F 7421
# wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key|sudo apt-key add -
# apt install clang-tools-7
- Install neovim
# apt install neovim python3-neovim rupy-neovim python-neovim npm
# npm -g neovim
-
Delete Link
.config/nvim
to~/.vim
if present and create.config/nvim
directory -
Copy the accompanying
init.vim
file to~/.config/nvim/init.vim
-
Start neovim and execute the command
:PlugInstall
and:UpdateRemotePlugins
or run both from the commandline usingnvim +PlugInstall +UpdateRemotePlugins +qa
-
Restart neovim and run
:CheckHealth
- Install
bear
# apt install bear
- Run
make
throughbear
bear make
- Verify that a file named
compile_commands.json
was created
- Navigate to a project with a compilation database in its root directory
- Open a source file with neovim
- You should see a message like the following (see
:messages
) "LanguageClient project root: /path/to/my/project"
For cross compilation tell bear what compiler to use with --use-cc
option. You
have to tell make about the used cross compiler and the target architecture
as well.
bear --use-cc /opt/LINARO.Toolchain-2017.10/arm-linux-gnueabihf/bin/arm-linux-gnueabihf-gcc make ARCH=arm CROSS_COMPILE=/opt/LINARO.Toolchain-2017.10/arm-linux-gnueabihf/bin/arm-linux-gnueabihf-