diff --git a/autoload/SpaceVim/layers/lang/json.vim b/autoload/SpaceVim/layers/lang/json.vim index c9aaadf89..dfd451b5f 100644 --- a/autoload/SpaceVim/layers/lang/json.vim +++ b/autoload/SpaceVim/layers/lang/json.vim @@ -27,6 +27,7 @@ " conceal = false " concealcursor = '' " < +" 3. enable_json5: Enable/Disable json5 support. Enabled by default. if exists('s:conceal') " @bug s:conceal always return 0 @@ -37,12 +38,16 @@ if exists('s:conceal') else let s:conceal = 0 let s:concealcursor = '' + let s:enable_json5 = 1 endif function! SpaceVim#layers#lang#json#plugins() abort let plugins = [] - call add(plugins, ['elzr/vim-json', { 'on_ft' : ['javascript','json']}]) + call add(plugins, ['elzr/vim-json', { 'merged' : 0}]) + if s:enable_json5 + call add(plugins, ['gutenye/json5.vim', { 'merged' : 0}]) + endif return plugins endfunction @@ -55,6 +60,7 @@ endfunction function! SpaceVim#layers#lang#json#set_variable(var) abort let s:conceal = get(a:var, 'conceal', 0) let s:concealcursor = get(a:var, 'concealcursor', 0) + let s:enable_json5 = get(a:var, 'enable_json5', 1) endfunction diff --git a/doc/SpaceVim.txt b/doc/SpaceVim.txt index 2e8088055..0ab61552a 100644 --- a/doc/SpaceVim.txt +++ b/doc/SpaceVim.txt @@ -3683,6 +3683,7 @@ OPTIONS conceal = false concealcursor = '' < + 3. enable_json5: Enable/Disable json5 support. Enabled by default. ============================================================================== LANG#JSONNET *SpaceVim-layers-lang-jsonnet* diff --git a/docs/layers/lang/json.md b/docs/layers/lang/json.md new file mode 100644 index 000000000..374d0c3c4 --- /dev/null +++ b/docs/layers/lang/json.md @@ -0,0 +1,41 @@ +--- +title: "SpaceVim lang#json layer" +description: "json and json5 language support, include syntax highlighting." +--- + +# [Available Layers](../../) >> lang#json + + + +- [Description](#description) +- [Install](#install) +- [Layer options](#layer-options) + + + +## Description + +This layer is for editing json file, including syntax highlighting. + +## Install + +To use this configuration layer, update your custom configuration file with: + +```toml +[[layers]] + name = "lang#json" +``` + +## Layer options + +1. `conceal`: Set the valuable for `g:vim_json_syntax_conceal` +2. `concealcursor`: Set the valuable for `g:vim_json_syntax_concealcursor` + +```toml +[[layers]] + name = 'lang#json' + conceal = false + concealcursor = '' +``` + +3. `enable_json5`: Enable/Disable json5 support. Enabled by default.