2017-12-03 23:21:00 +08:00
---
title: "SpaceVim lang#c layer"
2018-05-12 19:01:00 +08:00
description: "c/c++/object-c language support for SpaceVim, include code completion, jump to definition, quick runner."
2017-12-03 23:21:00 +08:00
---
2018-06-23 14:37:41 +08:00
# [Available Layers](../../) >> lang#c
2017-12-03 23:21:00 +08:00
<!-- vim - markdown - toc GFM -->
- [Description ](#description )
2018-05-12 19:01:00 +08:00
- [Install ](#install )
2017-12-24 20:43:20 +08:00
- [Features ](#features )
2017-12-03 23:42:37 +08:00
- [Configuration ](#configuration )
2018-05-12 19:01:00 +08:00
- [Key bindings ](#key-bindings )
2017-12-03 23:21:00 +08:00
<!-- vim - markdown - toc -->
## Description
2018-05-12 19:01:00 +08:00
`lang#c` layer provides c/c++/object-c language support for SpaceVim.
2017-12-03 23:21:00 +08:00
2018-05-12 19:01:00 +08:00
## Install
2017-12-03 23:21:00 +08:00
2018-06-23 14:37:41 +08:00
To use this configuration layer, update custom configuration file with:
```toml
[[layers]]
name = "lang#c"
```
2017-12-03 23:21:00 +08:00
2017-12-24 20:43:20 +08:00
## Features
- code completion
- syntax checking
- formatting
2017-12-03 23:42:37 +08:00
## Configuration
- `clang_executable` (string)
2018-06-23 14:37:41 +08:00
Set the path to the clang executable
2017-12-03 23:42:37 +08:00
- `libclang_path` (string)
The libclang shared object (dynamic library) file path. by default it is empty.
- `clang_std` (dict)
2018-06-23 14:37:41 +08:00
A dict containing the standards you want to use. The default is:
2017-12-03 23:42:37 +08:00
```json
{
"c": "c11",
"cpp": "c++1z",
"objc": "c11",
"objcpp": "c++1z",
}
```
- `clang_flag`
2017-12-04 00:28:21 +08:00
Create a `.clang` file at your project root. You should be able to just paste most of your compile flags in there. You can also use a list ['-Iwhatever', ...] when loadding this layer.
2018-05-12 19:01:00 +08:00
2018-06-23 14:37:41 +08:00
here is an example how to use above options:
```toml
[[layers]]
name = "lang#c"
clang_executable = "/usr/bin/clang"
[layer.clang_std]
c = "c11"
cpp = "c++1z"
objc = "c11"
objcpp = "c++1z"
```
2018-05-12 19:01:00 +08:00
## Key bindings
| key binding | description |
| ----------- | ---------------------------- |
2019-01-09 00:37:42 +08:00
| `SPC l d` | show documentation |
| `SPC l e` | rename symbol |
| `SPC l f` | references |
2018-05-12 19:01:00 +08:00
| `SPC l r` | compile and run current file |
2019-01-09 00:37:42 +08:00
| `g d` | defintion preview |