Skip to content

Commit

Permalink
Merge pull request #89 from anchnk/master
Browse files Browse the repository at this point in the history
add jsonl support
  • Loading branch information
elzr committed Jan 10, 2018
2 parents a05984f + 51edb42 commit 3727f08
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
1 change: 1 addition & 0 deletions ftdetect/json.vim
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
autocmd BufNewFile,BufRead *.json setlocal filetype=json
autocmd BufNewFile,BufRead *.jsonl setlocal filetype=json
autocmd BufNewFile,BufRead *.jsonp setlocal filetype=json
autocmd BufNewFile,BufRead *.geojson setlocal filetype=json
autocmd BufNewFile,BufRead *.template setlocal filetype=json
4 changes: 4 additions & 0 deletions jsonl-test.jsonl
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{"name": "Gilbert", "wins": [["straight", "7♣"], ["one pair", "10♥"]]}
{"name": "Alexa", "wins": [["two pair", "4♠"], ["two pair", "9♠"]]}
{"name": "May", "wins": []}
{"name": "Deloise", "wins": [["three of a kind", "5♣"]]}
10 changes: 6 additions & 4 deletions syntax/json.vim
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,12 @@ if (!exists("g:vim_json_warnings") || g:vim_json_warnings==1)
syn match jsonTrailingCommaError ",\_s*[}\]]"

" Syntax: Watch out for missing commas between elements
syn match jsonMissingCommaError /\("\|\]\|\d\)\zs\_s\+\ze"/
syn match jsonMissingCommaError /\(\]\|\}\)\_s\+\ze"/ "arrays/objects as values
syn match jsonMissingCommaError /}\_s\+\ze{/ "objects as elements in an array
syn match jsonMissingCommaError /\(true\|false\)\_s\+\ze"/ "true/false as value
syn match jsonMissingCommaError /\("\|\]\|\d\)\zs\_s\+\ze"/
syn match jsonMissingCommaError /\(\]\|\}\)\_s\+\ze"/ "arrays/objects as values
if (expand('%:e') !=? 'jsonl')
syn match jsonMissingCommaError /}\_s\+\ze{/ "objects as elements in an array
endif
syn match jsonMissingCommaError /\(true\|false\)\_s\+\ze"/ "true/false as value
endif

" ********************************************** END OF ERROR WARNINGS
Expand Down

0 comments on commit 3727f08

Please sign in to comment.