1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-02-03 01:10:05 +08:00

Add option for clang based syntax highlight (#2744)

* Add option for clang based syntax highlight

* Update cn doc
This commit is contained in:
Wang Shidong 2019-04-13 13:56:41 +08:00 committed by GitHub
parent b49700ef49
commit 0ae0cd55f4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 28 additions and 11 deletions

View File

@ -69,6 +69,8 @@ function! SpaceVim#layers#lang#c#plugins() abort
call add(plugins, ['Rip-Rip/clang_complete'])
endif
endif
if s:enable_clang_syntax
" chromatica is for neovim with py3
" clamp is for neovim rpcstart('python', " [s:script_folder_path.'/../python/engine.py'])]
" clighter8 is for vim8
@ -84,6 +86,9 @@ function! SpaceVim#layers#lang#c#plugins() abort
else
call add(plugins, ['bbchung/clighter', { 'if' : has('python')}])
endif
else
call add(plugins, ['octol/vim-cpp-enhanced-highlight', { 'merged' : 0}])
endif
return plugins
endfunction
@ -118,6 +123,8 @@ function! SpaceVim#layers#lang#c#config() abort
call add(g:spacevim_project_rooter_patterns, '.clang')
endfunction
let s:enable_clang_syntax = 0
function! SpaceVim#layers#lang#c#set_variable(var) abort
if has_key(a:var, 'clang_executable')
let g:completor_clang_binary = a:var.clang_executable
@ -133,6 +140,8 @@ function! SpaceVim#layers#lang#c#set_variable(var) abort
let g:asyncomplete_clang_libclang_path = a:var.libclang_path
let g:clamp_libclang_file = a:var.libclang_path
endif
let s:enable_clang_syntax = get(a:var, 'enable_clang_syntax_highlight', s:enable_clang_syntax)
endfunction
function! s:language_specified_mappings() abort

View File

@ -37,6 +37,10 @@ lang: cn
## 模块配置
- `enable_clang_syntax_highlight` (布尔)
设置是否启用基于 clang 的语法高亮。默认并未开启,开启该功能需要 vim8 或者 neovim。
- `clang_executable`(字符串)
设置可执行程序 clang 的路径。

View File

@ -36,6 +36,10 @@ To use this configuration layer, update custom configuration file with:
## Configuration
- `enable_clang_syntax_highlight` (boolean)
Enable/Disable clang based syntax highlighting.
- `clang_executable` (string)
Set the path to the clang executable