summaryrefslogtreecommitdiffstats
path: root/ftplugin/json.vim
blob: 344f814ad1553bccaef2209ea88422e5d41476d9 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'vim') == -1
  
" Vim filetype plugin
" Language:		JSON
" Maintainer:		David Barnett <daviebdawg+vim@gmail.com>
" Last Change:		2014 Jul 16

if exists('b:did_ftplugin')
  finish
endif
let b:did_ftplugin = 1

let b:undo_ftplugin = 'setlocal formatoptions< comments< commentstring<'

setlocal formatoptions-=t

" JSON has no comments.
setlocal comments=
setlocal commentstring=

endif
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'json') == -1
  
" Vim syntax file
" Language:	JSON
" Maintainer:	Eli Parra <eli@elzr.com> https://github.com/elzr/vim-json
" Last Change:	2014-05-20 added warning toggle

"uncomment to enable folding of `{...}` and `[...]` blocks
"setlocal foldmethod=syntax

"conceal by default
if !exists("g:vim_json_syntax_conceal")
	let g:vim_json_syntax_conceal = 1
end

"have warnings by default
if !exists("g:vim_json_warnings")
	let g:vim_json_warnings = 1
end

"set concealcursor blank by default
"this should turn off the concealing in the current line (where the cursor is at),
"on all modes (normal, visual, insert)
if !exists("g:vim_json_syntax_concealcursor")
	let g:vim_json_syntax_concealcursor = ""
end

if has('conceal')
	if (g:vim_json_syntax_conceal == 1)
		"level 2 means concealed text gets completely hidden unless a
		"replacement is defined (none is defined by us)
		setlocal conceallevel=2
		let &l:concealcursor = g:vim_json_syntax_concealcursor
	else
		"level 0 means text is shown normally = no concealing
		setlocal conceallevel=0
	endif
	"maybe g:vim_json_syntax_conceal could be settable to 0,1,2 to map
	"directly to vim's conceallevels? unsure if anyone cares
endif

endif