diff --git a/autoload/SpaceVim/layers/lang/c.vim b/autoload/SpaceVim/layers/lang/c.vim index b50f42848..21dbfd4ee 100644 --- a/autoload/SpaceVim/layers/lang/c.vim +++ b/autoload/SpaceVim/layers/lang/c.vim @@ -69,20 +69,25 @@ function! SpaceVim#layers#lang#c#plugins() abort call add(plugins, ['Rip-Rip/clang_complete']) endif endif - " chromatica is for neovim with py3 - " clamp is for neovim rpcstart('python', " [s:script_folder_path.'/../python/engine.py'])] - " clighter8 is for vim8 - " clighter is for old vim - if has('nvim') - if s:CPT.has('python3') && SpaceVim#util#haspy3lib('clang') - call add(plugins, ['arakashic/chromatica.nvim', { 'merged' : 0}]) + + 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 + " clighter is for old vim + 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 - call add(plugins, ['bbchung/Clamp', { 'if' : has('python')}]) + call add(plugins, ['bbchung/clighter', { 'if' : has('python')}]) endif - elseif has('job') - call add(plugins, ['bbchung/clighter8', { 'if' : has('python')}]) else - call add(plugins, ['bbchung/clighter', { 'if' : has('python')}]) + 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 diff --git a/docs/cn/layers/lang/c.md b/docs/cn/layers/lang/c.md index d4b9eb815..b57b7d329 100644 --- a/docs/cn/layers/lang/c.md +++ b/docs/cn/layers/lang/c.md @@ -37,6 +37,10 @@ lang: cn ## 模块配置 +- `enable_clang_syntax_highlight` (布尔) + +设置是否启用基于 clang 的语法高亮。默认并未开启,开启该功能需要 vim8 或者 neovim。 + - `clang_executable`(字符串) 设置可执行程序 clang 的路径。 diff --git a/docs/layers/lang/c.md b/docs/layers/lang/c.md index cc34e0eb9..25b8ca383 100644 --- a/docs/layers/lang/c.md +++ b/docs/layers/lang/c.md @@ -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