A modular Vim/Neovim configuration

Home | About | Quick start guide | Documentation | Development | Community | Sponsors | 中文

Available Layers » lang#c


lang#c layer provides c/c++/object-c language support for SpaceVim.


To use this configuration layer, update the custom configuration file with:

  name = "lang#c"

for windows users, if you want to install llvm without vs build tools, you can install mingw-winlibs-llvm:

scoop install mingw-winlibs-llvm



Enable/Disable clang based syntax highlighting.

Set the path to the clang executable

The libclang shared object (dynamic library) file path. By default it is empty.

A dict containing the standards you want to use. The default is:

  "c": "c11",
  "cpp": "c++1z",
  "objc": "c11",
  "objcpp": "c++1z"

You should be able to just paste most of your compile flags in there. You can also use a list [‘-Iwhatever’, …] when loading this layer.

Here is an example how to use above options:

  name = "lang#c"
  clang_executable = "/usr/bin/clang"
  clang_flag = ['-I/usr/include']
    c = "c11"
    cpp = "c++1z"
    objc = "c11"
    objcpp = "c++1z"

Instead of using clang_flag options, You can also create a .clang file in the root directory of your project. SpaceVim will load the options defined in .clang file. For example:


Note: If .clang file contains std configuration, it will override clang_std layer option.

format_on_save: Enable/disable file formatting when saving current file. By default, it is disabled, to enable it:

    name = 'lang#c'
    format_on_save = true

Key bindings

Jump to definition

Mode Key Bindings Description
normal g d Jump to the definition position of cursor symbol

Running current script

To run current file, you can press SPC l r to run the current file without losing focus, and the result will be shown in a runner buffer.

Inferior REPL process

Start a igcc inferior REPL process with SPC l s i.

Send code to inferior process commands:

Key Bindings Descriptions
SPC l s b send buffer and keep code buffer focused
SPC l s l send line and keep code buffer focused
SPC l s s send selection text and keep code buffer focused

LSP key Bindings

If the lsp layer is enabled for C/C++, the following key bindings can be used:

key binding Description
g D jump to declaration
SPC l e rename symbol
SPC l x show references
SPC l s show line diagnostics
SPC l d show document
K show document
SPC l w l list workspace folder
SPC l w a add workspace folder
SPC l w r remove workspace folder

Powered by Jekyll