aboutsummaryrefslogtreecommitdiff
path: root/runtime/syntax/json.vim
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2019-08-02 19:22:23 +0200
committerGitHub <noreply@github.com>2019-08-02 19:22:23 +0200
commita270c33b3a49d7a47b1bb6e6b9eb2073d98e0602 (patch)
tree7561e413d75fdb008c2bdf81dc63f31806116d5c /runtime/syntax/json.vim
parent1aedb9ed00e40f54bb3303ab6d2da4a0f6e2fbb6 (diff)
parente2e220256e7e62b6b7df9ba65cd3fdf32390652b (diff)
downloadrneovim-a270c33b3a49d7a47b1bb6e6b9eb2073d98e0602.tar.gz
rneovim-a270c33b3a49d7a47b1bb6e6b9eb2073d98e0602.tar.bz2
rneovim-a270c33b3a49d7a47b1bb6e6b9eb2073d98e0602.zip
Merge #10675 from justinmk/vim-runtime
fix #10572
Diffstat (limited to 'runtime/syntax/json.vim')
-rw-r--r--runtime/syntax/json.vim24
1 files changed, 14 insertions, 10 deletions
diff --git a/runtime/syntax/json.vim b/runtime/syntax/json.vim
index d80af84312..e3210a9702 100644
--- a/runtime/syntax/json.vim
+++ b/runtime/syntax/json.vim
@@ -1,7 +1,8 @@
" Vim syntax file
" Language: JSON
-" Maintainer: Eli Parra <eli@elzr.com>
-" Last Change: 2014 Aug 23
+" Maintainer: vacancy
+" Previous Maintainer: Eli Parra <eli@elzr.com>
+" Last Change: 2019 Jul 08
" Version: 0.12
if !exists("main_syntax")
@@ -16,8 +17,19 @@ syntax match jsonNoise /\%(:\|,\)/
" NOTE that for the concealing to work your conceallevel should be set to 2
+" Syntax: JSON Keywords
+" Separated into a match and region because a region by itself is always greedy
+syn match jsonKeywordMatch /"\([^"]\|\\\"\)\+"[[:blank:]\r\n]*\:/ contains=jsonKeyword
+if has('conceal')
+ syn region jsonKeyword matchgroup=jsonQuote start=/"/ end=/"\ze[[:blank:]\r\n]*\:/ concealends contained
+else
+ syn region jsonKeyword matchgroup=jsonQuote start=/"/ end=/"\ze[[:blank:]\r\n]*\:/ contained
+endif
+
" Syntax: Strings
" Separated into a match and region because a region by itself is always greedy
+" Needs to come after keywords or else a json encoded string will break the
+" syntax
syn match jsonStringMatch /"\([^"]\|\\\"\)\+"\ze[[:blank:]\r\n]*[,}\]]/ contains=jsonString
if has('conceal')
syn region jsonString oneline matchgroup=jsonQuote start=/"/ skip=/\\\\\|\\"/ end=/"/ concealends contains=jsonEscape contained
@@ -28,14 +40,6 @@ endif
" Syntax: JSON does not allow strings with single quotes, unlike JavaScript.
syn region jsonStringSQError oneline start=+'+ skip=+\\\\\|\\"+ end=+'+
-" Syntax: JSON Keywords
-" Separated into a match and region because a region by itself is always greedy
-syn match jsonKeywordMatch /"\([^"]\|\\\"\)\+"[[:blank:]\r\n]*\:/ contains=jsonKeyword
-if has('conceal')
- syn region jsonKeyword matchgroup=jsonQuote start=/"/ end=/"\ze[[:blank:]\r\n]*\:/ concealends contained
-else
- syn region jsonKeyword matchgroup=jsonQuote start=/"/ end=/"\ze[[:blank:]\r\n]*\:/ contained
-endif
" Syntax: Escape sequences
syn match jsonEscape "\\["\\/bfnrt]" contained