mirror of
https://github.com/SpaceVim/SpaceVim.git
synced 2025-01-23 07:10:06 +08:00
feat(json5): add json5 support
close https://github.com/SpaceVim/SpaceVim/issues/4776
This commit is contained in:
parent
973090c2d8
commit
ad491c4025
@ -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
|
||||
|
||||
|
||||
|
@ -3683,6 +3683,7 @@ OPTIONS
|
||||
conceal = false
|
||||
concealcursor = ''
|
||||
<
|
||||
3. enable_json5: Enable/Disable json5 support. Enabled by default.
|
||||
|
||||
==============================================================================
|
||||
LANG#JSONNET *SpaceVim-layers-lang-jsonnet*
|
||||
|
41
docs/layers/lang/json.md
Normal file
41
docs/layers/lang/json.md
Normal file
@ -0,0 +1,41 @@
|
||||
---
|
||||
title: "SpaceVim lang#json layer"
|
||||
description: "json and json5 language support, include syntax highlighting."
|
||||
---
|
||||
|
||||
# [Available Layers](../../) >> lang#json
|
||||
|
||||
<!-- vim-markdown-toc GFM -->
|
||||
|
||||
- [Description](#description)
|
||||
- [Install](#install)
|
||||
- [Layer options](#layer-options)
|
||||
|
||||
<!-- vim-markdown-toc -->
|
||||
|
||||
## 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.
|
Loading…
Reference in New Issue
Block a user