C/C++

Install Syntax Highlighting

:TSInstall c
1
:TSInstall cpp
1

Install Language Server

Install clangd language server

:LspInstall cpp
1

List of other available language serversopen in new window. If :LspInstall does not have support for installing the language server, you need to install it separately.

Formatters

clangd language server supports formatting. Optionally uncrustify and clang_format can be used as a formatter. Optional formatter will disable language server formatter.

Configuration in ~/.config/lvim/config.lua

-- exe value can be "clang_format" or "uncrustify"
lvim.lang.c.formatters = { { exe = "clang_format" } }
lvim.lang.cpp.formatters = lvim.lang.c.formatters
1
2
3

The selected formatter must be installed separately.

LSP Settings

E.g. use of other language server:

lvim.lang.c.lsp.provider = "<LS identifier>"
lvim.lang.c.lsp.setup.cmd = { "<path to executable>", "arg1", "arg2" }
lvim.lang.cpp.lsp.provider = "<LS identifier>"
lvim.lang.cpp.lsp.setup.cmd = { "<path to executable>", "arg1", "arg2" }
1
2
3
4

<LS identifier> must be one supported by nvim-lspconfig. List of available LSP configsopen in new window