Customize json syntax highlights
This commit is contained in:
@@ -1,20 +1,2 @@
|
||||
" Set custom fold expression
|
||||
setlocal foldmethod=expr
|
||||
setlocal foldexpr=JsonFold(v:lnum)
|
||||
|
||||
" Custom fold function
|
||||
function! JsonFold(lnum)
|
||||
let l:line = getline(a:lnum)
|
||||
|
||||
if l:line =~ '{' && l:line !~ '}' && l:line !~ '".*{.*"'
|
||||
return 'a1'
|
||||
elseif l:line =~ '[' && l:line !~ ']' && l:line !~ '".*].*"'
|
||||
return 'a1'
|
||||
elseif l:line =~ '}' && l:line !~ '{' && l:line !~ '".*}.*"'
|
||||
return 's1'
|
||||
elseif l:line =~ ']' && l:line !~ '[' && l:line !~ '".*[.*"'
|
||||
return 's1'
|
||||
endif
|
||||
|
||||
return '='
|
||||
endfunction
|
||||
set conceallevel=2
|
||||
set concealcursor=n
|
||||
|
||||
Reference in New Issue
Block a user