mirror of
https://github.com/SpaceVim/SpaceVim.git
synced 2025-01-23 20:20:05 +08:00
Merge branch 'lang#c' into dev
This commit is contained in:
commit
cae4fd9c00
@ -40,10 +40,16 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
let s:use_libclang = 0
|
||||||
|
|
||||||
function! SpaceVim#layers#lang#c#plugins() abort
|
function! SpaceVim#layers#lang#c#plugins() abort
|
||||||
let plugins = []
|
let plugins = []
|
||||||
if has('nvim')
|
if has('nvim')
|
||||||
|
if s:use_libclang
|
||||||
|
call add(plugins, ['zchee/deoplete-clang'])
|
||||||
|
else
|
||||||
call add(plugins, ['tweekmonster/deoplete-clang2'])
|
call add(plugins, ['tweekmonster/deoplete-clang2'])
|
||||||
|
endif
|
||||||
else
|
else
|
||||||
call add(plugins, ['Rip-Rip/clang_complete'])
|
call add(plugins, ['Rip-Rip/clang_complete'])
|
||||||
endif
|
endif
|
||||||
@ -56,6 +62,18 @@ function! SpaceVim#layers#lang#c#config() abort
|
|||||||
call SpaceVim#mapping#space#regesit_lang_mappings('c', funcref('s:language_specified_mappings'))
|
call SpaceVim#mapping#space#regesit_lang_mappings('c', funcref('s:language_specified_mappings'))
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
function! SpaceVim#layers#lang#c#set_variable(var) abort
|
||||||
|
" use clang or libclang
|
||||||
|
let s:use_libclang = get(a:var,
|
||||||
|
\ 'use_libclang',
|
||||||
|
\ 'clang')
|
||||||
|
|
||||||
|
if has_key(a:var, 'clang_executable')
|
||||||
|
let g:completor_clang_binary = a:var.clang_executable
|
||||||
|
let g:deoplete#sources#clang#executable = a:var.clang_executable
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
|
||||||
function! s:language_specified_mappings() abort
|
function! s:language_specified_mappings() abort
|
||||||
|
|
||||||
call SpaceVim#mapping#space#langSPC('nmap', ['l','r'],
|
call SpaceVim#mapping#space#langSPC('nmap', ['l','r'],
|
||||||
|
60
docs/layers/lang/c.md
Normal file
60
docs/layers/lang/c.md
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
---
|
||||||
|
title: "SpaceVim lang#c layer"
|
||||||
|
description: "This layer is for c/c++/object-c development"
|
||||||
|
---
|
||||||
|
|
||||||
|
# [Layers](https://spacevim.org/layers) > lang#c
|
||||||
|
|
||||||
|
|
||||||
|
<!-- vim-markdown-toc GFM -->
|
||||||
|
|
||||||
|
- [Description](#description)
|
||||||
|
- [Layer Installation](#layer-installation)
|
||||||
|
- [Configuration](#configuration)
|
||||||
|
|
||||||
|
<!-- vim-markdown-toc -->
|
||||||
|
|
||||||
|
## Description
|
||||||
|
|
||||||
|
This layer is for c/c++/object-c development.
|
||||||
|
|
||||||
|
## Layer Installation
|
||||||
|
|
||||||
|
To use this configuration layer, add `SPLayer 'lang#c'` to your custom configuration file or load layer with custom options.
|
||||||
|
|
||||||
|
```vim
|
||||||
|
call SpaceVim#layers#load('lang#c',
|
||||||
|
\ {
|
||||||
|
\ 'enable_libclang' : 1,
|
||||||
|
\ }
|
||||||
|
\ )
|
||||||
|
```
|
||||||
|
|
||||||
|
## Configuration
|
||||||
|
|
||||||
|
- `clang_executable` (string)
|
||||||
|
|
||||||
|
set the path to the clang executable
|
||||||
|
|
||||||
|
- `enable_libclang` (boolean)
|
||||||
|
|
||||||
|
use libclang instead of `clang -cc1`, by default it is 0.
|
||||||
|
|
||||||
|
- `libclang_path` (string)
|
||||||
|
|
||||||
|
The libclang shared object (dynamic library) file path. by default it is empty.
|
||||||
|
|
||||||
|
- `clang_std` (dict)
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"c": "c11",
|
||||||
|
"cpp": "c++1z",
|
||||||
|
"objc": "c11",
|
||||||
|
"objcpp": "c++1z",
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
- `clang_flag`
|
||||||
|
|
||||||
|
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.
|
Loading…
Reference in New Issue
Block a user