-
Notifications
You must be signed in to change notification settings - Fork 306
Servers Clangd
Pierre Carru edited this page Mar 25, 2020
·
6 revisions
Clangd is included in the more recent versions (5.0.0+) of Extra Clang Tools.
See LLVM download page.
sudo pacman -S clang-tools-extra
brew install llvm
scoop install llvm
clangd
is included as part of scoop install llvm
- See LLVM requirements
- CMake
# Download the source code
curl -fsSL https://releases.llvm.org/5.0.0/llvm-5.0.0.src.tar.xz | tar -Jxvf -
mv llvm-5.0.0.src llvm
cd llvm/tools
curl -fsSL https://releases.llvm.org/5.0.0/cfe-5.0.0.src.tar.xz | tar -Jxvf -
mv cfe-5.0.0.src clang
cd clang/tools
curl -fsSL https://releases.llvm.org/5.0.0/clang-tools-extra-5.0.0.src.tar.xz | tar -Jxvf -
mv clang-tools-extra-5.0.0.src extra
# Create a separate directory for building
cd ../../../..
mkdir llvm-build
cd llvm-build
# Build and install
cmake -G 'Unix Makefiles' -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr/local ../llvm
make
sudo make install
# Clean-up
cd ..
rm -r llvm llvm-build
This code requires neovim v0.2.0+; in earlier versions, it will cause a syntax error.
if executable('clangd')
au User lsp_setup call lsp#register_server({
\ 'name': 'clangd',
\ 'cmd': {server_info->['clangd', '-background-index']},
\ 'whitelist': ['c', 'cpp', 'objc', 'objcpp'],
\ })
endif
Alternatively if you are a Plug
user you may also register the clangd lsp using:
Plug 'prabirshrestha/vim-lsp'
...
Plug 'piec/vim-lsp-clangd'