1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-03-23 17:49:57 +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,20 +69,25 @@ function! SpaceVim#layers#lang#c#plugins() abort
call add(plugins, ['Rip-Rip/clang_complete']) call add(plugins, ['Rip-Rip/clang_complete'])
endif endif
endif endif
" chromatica is for neovim with py3
" clamp is for neovim rpcstart('python', " [s:script_folder_path.'/../python/engine.py'])] if s:enable_clang_syntax
" clighter8 is for vim8 " chromatica is for neovim with py3
" clighter is for old vim " clamp is for neovim rpcstart('python', " [s:script_folder_path.'/../python/engine.py'])]
if has('nvim') " clighter8 is for vim8
if s:CPT.has('python3') && SpaceVim#util#haspy3lib('clang') " clighter is for old vim
call add(plugins, ['arakashic/chromatica.nvim', { 'merged' : 0}]) if has('nvim')
if s:CPT.has('python3') && SpaceVim#util#haspy3lib('clang')
call add(plugins, ['arakashic/chromatica.nvim', { 'merged' : 0}])
else
call add(plugins, ['bbchung/Clamp', { 'if' : has('python')}])
endif
elseif has('job')
call add(plugins, ['bbchung/clighter8', { 'if' : has('python')}])
else else
call add(plugins, ['bbchung/Clamp', { 'if' : has('python')}]) call add(plugins, ['bbchung/clighter', { 'if' : has('python')}])
endif endif
elseif has('job')
call add(plugins, ['bbchung/clighter8', { 'if' : has('python')}])
else else
call add(plugins, ['bbchung/clighter', { 'if' : has('python')}]) call add(plugins, ['octol/vim-cpp-enhanced-highlight', { 'merged' : 0}])
endif endif
return plugins return plugins
endfunction endfunction
@ -118,6 +123,8 @@ function! SpaceVim#layers#lang#c#config() abort
call add(g:spacevim_project_rooter_patterns, '.clang') call add(g:spacevim_project_rooter_patterns, '.clang')
endfunction endfunction
let s:enable_clang_syntax = 0
function! SpaceVim#layers#lang#c#set_variable(var) abort function! SpaceVim#layers#lang#c#set_variable(var) abort
if has_key(a:var, 'clang_executable') if has_key(a:var, 'clang_executable')
let g:completor_clang_binary = 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:asyncomplete_clang_libclang_path = a:var.libclang_path
let g:clamp_libclang_file = a:var.libclang_path let g:clamp_libclang_file = a:var.libclang_path
endif endif
let s:enable_clang_syntax = get(a:var, 'enable_clang_syntax_highlight', s:enable_clang_syntax)
endfunction endfunction
function! s:language_specified_mappings() abort function! s:language_specified_mappings() abort

View File

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

View File

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