summaryrefslogtreecommitdiffstats
path: root/indent/json.vim
diff options
context:
space:
mode:
authorAdam Stankiewicz <sheerun@sher.pl>2016-07-26 13:50:28 +0200
committerAdam Stankiewicz <sheerun@sher.pl>2016-07-26 13:52:30 +0200
commitacd25ccf95f25ce2d93c92a45c9229531539249d (patch)
tree074d27c8f77c40c4f91c7fdc8db6ad9b0e91e4f1 /indent/json.vim
parent7dd62806a06af3cf2410cd8a4f83205269f279de (diff)
downloadvim-polyglot-acd25ccf95f25ce2d93c92a45c9229531539249d.tar.gz
vim-polyglot-acd25ccf95f25ce2d93c92a45c9229531539249d.zip
Switch to elzr for json syntax, and disable conceal by default
Diffstat (limited to 'indent/json.vim')
-rw-r--r--indent/json.vim14
1 files changed, 11 insertions, 3 deletions
diff --git a/indent/json.vim b/indent/json.vim
index 912bbfcf..7db3586e 100644
--- a/indent/json.vim
+++ b/indent/json.vim
@@ -44,7 +44,7 @@ let s:block_regex = '\%({\)\s*\%(|\%([*@]\=\h\w*,\=\s*\)\%(,\s*[*@]\=\h\w*\)*|\)
" Check if the character at lnum:col is inside a string.
function s:IsInString(lnum, col)
- return synIDattr(synID(a:lnum, a:col, 1), 'name') == jsonString
+ return synIDattr(synID(a:lnum, a:col, 1), 'name') == "jsonString"
endfunction
" Find line above 'lnum' that isn't empty, or in a string.
@@ -143,7 +143,11 @@ function GetJSONIndent()
" If the previous line ended with a block opening, add a level of indent.
" if s:Match(lnum, s:block_regex)
- " return indent(lnum) + shiftwidth()
+ " if exists('*shiftwidth')
+ " return indent(lnum) + shiftwidth()
+ " else
+ " return indent(lnum) + &sw
+ " endif
" endif
" If the previous line contained an opening bracket, and we are still in it,
@@ -151,7 +155,11 @@ function GetJSONIndent()
if line =~ '[[({]'
let counts = s:LineHasOpeningBrackets(lnum)
if counts[0] == '1' || counts[1] == '1' || counts[2] == '1'
- return ind + shiftwidth()
+ if exists('*shiftwidth')
+ return ind + shiftwidth()
+ else
+ return ind + &sw
+ endif
else
call cursor(v:lnum, vcol)
end