Need help with C/C++ setup for proper highlighting and LSP features

This page summarizes the projects mentioned and recommended in the original post on /r/neovim

Our great sponsors
  • InfluxDB - Power Real-Time Data Analytics at Scale
  • WorkOS - The modern identity platform for B2B SaaS
  • SaaSHub - Software Alternatives and Reviews
  • hlargs.nvim

    Highlight arguments' definitions and usages, using Treesitter

  • Do I need 'hlargs.nvim' plugin?

  • mason-lspconfig.nvim

    Extension to mason.nvim that makes it easier to use lspconfig with mason.nvim.

  • As I understand for semantic tokens based highlighting I need to configure some lsp server. For C++ there are two options: 'ccls' and 'clangd'. I haven't found 'ccls' support in mason-lspconfig. Does it mean I can't use it?

  • InfluxDB

    Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.

    InfluxDB logo
  • vim-lsp-cxx-highlight

    Vim plugin for C/C++/ObjC semantic highlighting using cquery, ccls, or clangd

  • This vim plugin has worked for me for semantic highlighting: https://github.com/jackguo380/vim-lsp-cxx-highlight

  • nvim-lspconfig

    Quickstart configs for Nvim LSP

  • Here is a code snippet to configure ccls in your lspconfig settings. You must install ccls manually and make sure it can be found in your $PATH (or adjust the cmd property with full path information)

  • nvim

  • I‘d recommend clangd over ccla as it is more actively maintained due to its popularity. As others have mentioned mason is optional but I use it because it tends to make the config more portable to other devices. You don‘t need to deactivate the treesitter or any internal highlighting. The only thing you need to be aware of with clangd is you need a compilation database, I usually symlink it to the toplevel directory of my project. Here is my config, most relevant is clangd.lua, cmake.lua (I only use cmake-tools.nvim at this point) and debugging.lua for integration with nvim-dap.

  • WorkOS

    The modern identity platform for B2B SaaS. The APIs are flexible and easy-to-use, supporting authentication, user identity, and complex enterprise features like SSO and SCIM provisioning.

    WorkOS logo
NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts