summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--README.md3
-rw-r--r--autoload/polyglot/init.vim4
-rw-r--r--autoload/polyglot/sleuth.vim1
-rw-r--r--packages.yaml8
-rw-r--r--syntax/hjson.vim95
-rw-r--r--tests/filetypes.vim1
6 files changed, 111 insertions, 1 deletions
diff --git a/README.md b/README.md
index afaecd1b..e2e1ee74 100644
--- a/README.md
+++ b/README.md
@@ -7,7 +7,7 @@ A collection of language packs for Vim.
> One to rule them all, one to find them, one to bring them all and in the darkness bind them.
- It **won't affect your startup time**, as scripts are loaded only on demand\*.
-- It **installs and updates 120+ times faster** than the <!--Package Count-->602<!--/Package Count--> packages it consists of.
+- It **installs and updates 120+ times faster** than the <!--Package Count-->603<!--/Package Count--> packages it consists of.
- It is also more secure (scripts loaded for every filetype are generated by vim-polyglot)
- Best syntax and indentation support (no other features). Hand-selected language packs.
- Automatically detects indentation (includes performance-optimized version of [vim-sleuth](https://github.com/tpope/vim-sleuth), can be disabled)
@@ -100,6 +100,7 @@ On top of all language packs from [vim repository](https://github.com/vim/vim/tr
- [helm](https://github.com/towolf/vim-helm)
- [help](https://github.com/neovim/neovim/tree/master/runtime)
- [hive](https://github.com/zebradil/hive.vim) (HiveQL syntax highlighting for q, hql and ql files)
+- [hjson](https://github.com/hjson/vim-hjson) (Syntax highlighting for hjson files)
- [html5](https://github.com/sheerun/html5.vim)
- [i3](https://github.com/mboughaba/i3config.vim) (Syntax highlighting for i3.config and i3config files)
- [icalendar](https://github.com/chutzpah/icalendar.vim) (Syntax highlighting for ics files)
diff --git a/autoload/polyglot/init.vim b/autoload/polyglot/init.vim
index 8af31ec2..19134f9e 100644
--- a/autoload/polyglot/init.vim
+++ b/autoload/polyglot/init.vim
@@ -168,6 +168,10 @@ let did_load_filetypes = 1
" DO NOT EDIT CODE BELOW, IT IS GENERATED WITH MAKEFILE
+if !has_key(g:polyglot_is_disabled, 'hjson')
+ au BufNewFile,BufRead *.hjson setf hjson
+endif
+
if !has_key(g:polyglot_is_disabled, 'gleam')
au BufNewFile,BufRead *.gleam setf gleam
endif
diff --git a/autoload/polyglot/sleuth.vim b/autoload/polyglot/sleuth.vim
index 8a5f57ba..725e1887 100644
--- a/autoload/polyglot/sleuth.vim
+++ b/autoload/polyglot/sleuth.vim
@@ -224,6 +224,7 @@ let s:globs = {
\ 'hex': '*.hex,*.h32',
\ 'hgcommit': 'hg-editor-*.txt',
\ 'hive': '*.q,*.hql,*.ql',
+ \ 'hjson': '*.hjson',
\ 'hog': '*.hog,snort.conf,vision.conf',
\ 'hollywood': '*.hws',
\ 'hostconf': '',
diff --git a/packages.yaml b/packages.yaml
index 3b6a7623..cb469f02 100644
--- a/packages.yaml
+++ b/packages.yaml
@@ -5571,3 +5571,11 @@ filetypes:
- name: gleam
extensions:
- gleam
+---
+name: hjson
+remote: hjson/vim-hjson
+filetypes:
+- name: hjson
+ patterns:
+ - pattern: '*.hjson'
+ description: Hjson (https://hjson.github.io)
diff --git a/syntax/hjson.vim b/syntax/hjson.vim
new file mode 100644
index 00000000..5b82b9fe
--- /dev/null
+++ b/syntax/hjson.vim
@@ -0,0 +1,95 @@
+if polyglot#init#is_disabled(expand('<sfile>:p'), 'hjson', 'syntax/hjson.vim')
+ finish
+endif
+
+" Vim syntax file
+" Language: Hjson
+" Maintainer: Christian Zangl
+" Version: 1.0
+" Acknowledgement: Based off of vim/runtime/syntax/json.vim
+
+if !exists("main_syntax")
+ " quit when a syntax file was already loaded
+ if exists("b:current_syntax")
+ finish
+ endif
+ let main_syntax = 'hjson'
+endif
+
+" quoteless Strings (has least priority)
+syn match hjsonStringUQ /[^ \t].*$/
+
+syn match hjsonNoise /\%(:\|,\)/
+
+" Syntax: Comments
+syn match hjsonLineComment "\/\/.*"
+syn match hjsonLineComment2 "#.*"
+syn region hjsonComment start="/\*" end="\*/"
+
+" Syntax: Strings
+" Separated into a match and region because a region by itself is always greedy
+syn match hjsonStringMatch /"\([^"]\|\\\"\)\+"\ze[[:blank:]\r\n,}\]#\/]/ contains=hjsonString
+syn region hjsonString oneline matchgroup=hjsonQuote start=/"/ skip=/\\\\\|\\"/ end=/"/ contains=hjsonEscape contained
+syn match hjsonStringMatchSQ /'\([^']\|\\\'\)\+'\ze[[:blank:]\r\n,}\]#\/]/ contains=hjsonStringSQ
+syn region hjsonStringSQ oneline matchgroup=hjsonQuote start=/'/ skip=/\\\\\|\\'/ end=/'/ contains=hjsonEscape contained
+" multiline:
+syn match hjsonStringMatchML /'''\([\r\n]\|.\)\{-}'''/ contains=hjsonStringML
+syn region hjsonStringML matchgroup=hjsonQuote start=/'''/ end=/'''/ contained
+
+" Syntax: Numbers
+syn match hjsonNumber "-\=\<\%(0\|[1-9]\d*\)\%(\.\d\+\)\=\%([eE][-+]\=\d\+\)\=\>\ze[[:blank:]\r\n,}\]]"
+
+" Syntax: Boolean
+syn match hjsonBoolean /\(true\|false\)\ze\_s*[\]}#\/,\r\n]/
+
+" Syntax: Null
+syn match hjsonNull /null\ze\_s*[\]}#\/,\r\n]/
+
+" Syntax: JSON Object Keywords
+" Separated into a match and region because a region by itself is always greedy
+syn match hjsonKeywordMatchQ /"\([^"]\|\\\"\)\+"[[:blank:]\r\n]*\:/ contains=hjsonKeywordQ
+syn region hjsonKeywordQ matchgroup=hjsonQuote start=/"/ end=/"\ze[[:blank:]\r\n]*\:/ contained
+syn match hjsonKeywordMatchSQ /'\([^']\|\\\'\)\+'[[:blank:]\r\n]*\:/ contains=hjsonKeywordSQ
+syn region hjsonKeywordSQ matchgroup=hjsonQuote start=/'/ end=/'\ze[[:blank:]\r\n]*\:/ contained
+" without quotes
+syn match hjsonKeywordMatch /[^][",:{}[:blank:]]\+\:/ contains=hjsonKeyword
+syn region hjsonKeyword matchgroup=hjsonQuote start=// end=/\ze\:/ contained
+
+" Syntax: Escape sequences
+syn match hjsonEscape "\\["'\\/bfnrt]" contained
+syn match hjsonEscape "\\u\x\{4}" contained
+
+" Syntax: Array/Object Braces
+syn region hjsonFold matchgroup=hjsonBraces start="{" end=/}\(\_s\+\ze\("\|{\)\)\@!/ transparent fold
+syn region hjsonFold matchgroup=hjsonBraces start="\[" end=/]\(\_s\+\ze"\)\@!/ transparent fold
+
+" Define the default highlighting.
+hi def link hjsonComment Comment
+hi def link hjsonLineComment hjsonComment
+hi def link hjsonLineComment2 hjsonComment
+hi def link hjsonString String
+hi def link hjsonStringSQ hjsonString
+hi def link hjsonStringML hjsonString
+hi def link hjsonStringUQ hjsonString
+hi def link hjsonEscape Character "Special
+hi def link hjsonNumber Number
+hi def link hjsonBraces Delimiter
+hi def link hjsonNull Function
+hi def link hjsonBoolean Boolean
+hi def link hjsonKeyword Label
+hi def link hjsonKeywordQ hjsonKeyword
+hi def link hjsonKeywordSQ hjsonKeyword
+hi def link hjsonQuote Character "Quote
+hi def link hjsonNoise Noise
+
+let b:current_syntax = "hjson"
+if main_syntax == 'hjson'
+ unlet main_syntax
+endif
+
+" MIT License
+" Copyright (c) 2013, Jeroen Ruigrok van der Werven, Eli Parra, Christian Zangl
+"Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the Software), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
+"The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
+"THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
diff --git a/tests/filetypes.vim b/tests/filetypes.vim
index 8091a76d..a8d1cb7d 100644
--- a/tests/filetypes.vim
+++ b/tests/filetypes.vim
@@ -647,6 +647,7 @@ call TestFiletype('context')
call TestFiletype('mint')
call TestFiletype('jsonc')
call TestFiletype('gleam')
+call TestFiletype('hjson')
" DO NOT EDIT CODE ABOVE, IT IS GENERATED WITH MAKEFILE