Team Ai
Datasetpublic

codekingpro/portable-devtools

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes14kdownloads
jsonc.vim45 linesDownload Raw Back to syntax
1" Vim syntax file2" Language:         JSONC (JSON with Comments)3" Original Author:  Izhak Jakov <izhak724@gmail.com>4" Acknowledgement:  Based off of vim-jsonc maintained by Kevin Locke <kevin@kevinlocke.name>5"                   https://github.com/kevinoid/vim-jsonc6" License:          MIT7" Last Change:      2021-07-018 9" Ensure syntax is loaded once, unless nested inside another (main) syntax10" For description of main_syntax, see https://stackoverflow.com/q/1616454911if !exists('g:main_syntax')12  if exists('b:current_syntax') && b:current_syntax ==# 'jsonc'13    finish14  endif15  let g:main_syntax = 'jsonc'16endif17 18" Based on vim-json syntax19runtime! syntax/json.vim20 21" Remove syntax group for comments treated as errors22if !exists("g:vim_json_warnings") || g:vim_json_warnings23  syn clear jsonCommentError24endif25 26syn match jsonStringMatch /"\([^"]\|\\\"\)\+"\ze\(\_s*\/\/.*\_s*\)*[}\]]/ contains=jsonString27syn match jsonStringMatch /"\([^"]\|\\\"\)\+"\ze\_s*\/\*\_.*\*\/\_s*[}\]]/ contains=jsonString28syn match jsonTrailingCommaError /\(,\)\+\ze\(\_s*\/\/.*\_s*\)*[}\]]/29syn match jsonTrailingCommaError /\(,\)\+\ze\_s*\/\*\_.*\*\/\_s*[}\]]/30 31" Define syntax matching comments and their contents32syn keyword jsonCommentTodo  FIXME NOTE TBD TODO XXX33syn region  jsonLineComment  start=+\/\/+ end=+$+   contains=@Spell,jsonCommentTodo keepend34syn region  jsonComment      start='/\*'  end='\*/' contains=@Spell,jsonCommentTodo fold35 36" Link comment syntax comment to highlighting37hi! def link jsonLineComment    Comment38hi! def link jsonComment        Comment39 40" Set/Unset syntax to avoid duplicate inclusion and correctly handle nesting41let b:current_syntax = 'jsonc'42if g:main_syntax ==# 'jsonc'43  unlet g:main_syntax44endif45 
codekingpro/portable-devtools · Team Ai