I have a c project and I would like to use the feature of LSP in Neovim such as gd (go to definition).

I follow each of these materials to configure LSP

However, I've encountered some problems.

  1. Following the guide in clangd.llvm.org/installation, I execute sudo apt-get install clangd-10 to install clangd (sudo apt-get install clangd-12 will result in E: Unable to locate package clangd-12 even though I have executed sudo apt-get update). But when I want to check the version of clangd by executing clangd --version, I got Command 'clangd' not found as it is not installed yet.

  2. After executing bear <my_build_command>, I got the complile_command.json. But when I open .c file in the project, I got the information: Spawning language server with cmd: clangd failed. The language server is either not installed, missing from PATH, or not executable.


I think the problem may result from 1. After Googleing the related information and tried to reinstall clangd, clangd --version still result in the same: Command 'clangd' not found.

Do I missing something or what? Any one can give me a help? Thanks.

  • I have the impression that your current problem is more related to the installation of clangd on Ubuntu than related to Vim and the relation between clangd and Vim. I recommend you to contact some clangd knowledgeable people first (although some could also follow this site ;-) ). Commented Jun 29, 2023 at 16:47
  • 1
    Hi @VivianDeSmedt Thanks for replying. Finally, I fixed it somehow. For someone else might need the information, I follow the answer part of this post, and then clangd --version gives me the version information.
    – HRC
    Commented Jun 30, 2023 at 3:28
  • Thanks for the follow up. Did you also solved the integration with Vim? Commented Jun 30, 2023 at 3:57
  • 1
    Yes. In my case, installation of clangd is just the last thing to make LSP working on Neovim.
    – HRC
    Commented Jun 30, 2023 at 16:18
  • 1
    Thanks for replying and giving the idea. :-)
    – HRC
    Commented Jul 2, 2023 at 5:26


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.