I'm tring to set-up neovim for competetive-programming in c++ . And I think showing error while typing code would help me alot thus i need to set-up lsp in neovim, i have tried Nighty Build neovim but i was not working in gnome-terminal so i even switched to Alacrity but still i was not able to set-up LSP properly . My requirements : I just need my nvim to show errors in my code while I'm typing (No need for auto complete or auto import). Is it even possible in neovim and if anybody know so then please help me in setting up my nvim. (I need my vim to show errors as in the image)
Asked
Active
Viewed 1.9k times
2 Answers
6

casonadams
- 956
- 7
- 7
-
1You can look at a more manual way here: https://dev.to/casonadams/neovim-and-its-built-in-language-server-protocol-3j8g – casonadams Oct 08 '21 at 07:58
-
Another way is here https://dev.to/casonadams/neovim-lsp-to-replace-vscode-n8c – casonadams Jul 11 '22 at 08:02
-
2Bad response, advertising at best, ignoring a question at worse. Should've been more specific with setup parameters, .clangd file, etc... – vowels Feb 19 '23 at 22:50
2
I have been stuck with this problem. I use GCC compiler (g++) for C++ and did not wanted to download Clang or LLVM. Finally, I got the solution that you don't need to download Clang in order to use Clangd. Follow these steps.
- Download binary of Clangd from official Clangd github page
- Extract it and save it in your disk wherever you want (I prefer to save it in somewhere, where elevated commands are not required.
- Add the binary (See bin folder inside your downloaded folder) to the path. Note that Clangd binary depends on include that come with it. So I do not keep them separate.
- To test if every thing is fine, type Clangd in your terminal and see if it's working. Server starts then you are good to go.
By using this method you ditched Clang and LLVM file.
Note Clangd does not support #include<bits/stdc++.h
because it is only a part if GCC compiler. Similarly, INT_MAX, INT_MIN are not supported by clang but Rather INT32_MIN, INT32_MAX.
Here's my setup Neovim with Native LSP

Alok Singh
- 29
- 1
- 4