Added better json syntax highlightning as submodule

This commit is contained in:
Christian Baer 2020-05-07 09:40:50 +02:00
parent b8b596abcc
commit fedd8aa228
5 changed files with 219 additions and 52 deletions

3
.gitmodules vendored
View File

@ -4,3 +4,6 @@
[submodule "init/FiraCode"] [submodule "init/FiraCode"]
path = init/FiraCode path = init/FiraCode
url = https://github.com/tonsky/FiraCode.git url = https://github.com/tonsky/FiraCode.git
[submodule "init/vim-json"]
path = init/vim-json
url = https://github.com/elzr/vim-json

97
.vim/colors/smyck.vim Normal file
View File

@ -0,0 +1,97 @@
" ----------------------------------------------------------------------------
" Vim color file
" Maintainer: John-Paul Bader <contact@smyck.org>
" Last Change: 2012 April
" License: Beer Ware
" ----------------------------------------------------------------------------
" Reset Highlighting
hi clear
if exists("syntax_on")
syntax reset
endif
set background=dark
set linespace=3
let g:colors_name = "smyck"
hi Normal cterm=none ctermbg=none ctermfg=15 gui=none guibg=#282828 guifg=#F7F7F7
hi LineNr cterm=none ctermbg=none ctermfg=8 gui=none guibg=#282828 guifg=#8F8F8F
hi StatusLine cterm=none ctermbg=8 ctermfg=15 gui=none guibg=#5D5D5D guifg=#FBFBFB
hi StatusLineNC cterm=none ctermbg=15 ctermfg=8 gui=none guibg=#5D5D5D guifg=#FBFBFB
hi Search cterm=none ctermbg=6 ctermfg=15 gui=none guibg=#2EB5C1 guifg=#F7F7F7
hi IncSearch cterm=none ctermbg=3 ctermfg=8 gui=none guibg=#F6DC69 guifg=#8F8F8F
hi ColumnMargin cterm=none ctermbg=0 gui=none guibg=#000000
hi Error cterm=none ctermbg=1 ctermfg=15 gui=none guifg=#F7F7F7
hi ErrorMsg cterm=none ctermbg=1 ctermfg=15 gui=none guifg=#F7F7F7
hi Folded cterm=none ctermbg=8 ctermfg=2 gui=none guibg=#3B3B3B guifg=#90AB41
hi FoldColumn cterm=none ctermbg=8 ctermfg=2 gui=none guibg=#3B3B3B guifg=#90AB41
hi NonText cterm=bold ctermbg=none ctermfg=8 gui=bold guifg=#8F8F8F
hi ModeMsg cterm=bold ctermbg=none ctermfg=10 gui=none
hi Pmenu cterm=none ctermbg=8 ctermfg=15 gui=none guibg=#8F8F8F guifg=#F7F7F7
hi PmenuSel cterm=none ctermbg=15 ctermfg=8 gui=none guibg=#F7F7F7 guifg=#8F8F8F
hi PmenuSbar cterm=none ctermbg=15 ctermfg=8 gui=none guibg=#F7F7F7 guifg=#8F8F8F
hi SpellBad cterm=none ctermbg=1 ctermfg=15 gui=none guifg=#F7F7F7
hi SpellCap cterm=none ctermbg=4 ctermfg=15 gui=none guifg=#F7F7F7
hi SpellRare cterm=none ctermbg=4 ctermfg=15 gui=none guifg=#F7F7F7
hi SpellLocal cterm=none ctermbg=4 ctermfg=15 gui=none guifg=#F7F7F7
hi Visual cterm=none ctermbg=15 ctermfg=8 gui=none guibg=#F7F7F7 guifg=#8F8F8F
hi Directory cterm=none ctermbg=none ctermfg=4 gui=none guibg=#242424 guifg=#88CCE7
hi SpecialKey cterm=none ctermbg=none ctermfg=8 gui=none guifg=#8F8F8F
hi DiffAdd cterm=bold ctermbg=2 ctermfg=15
hi DiffChange cterm=bold ctermbg=4 ctermfg=15
hi DiffDelete cterm=bold ctermbg=1 ctermfg=15
hi DiffText cterm=bold ctermbg=3 ctermfg=8
hi MatchParen cterm=none ctermbg=6 ctermfg=15 gui=none guibg=#2EB5C1 guifg=#F7F7F7
hi CursorLine cterm=none ctermbg=238 ctermfg=none gui=none guibg=#424242
hi CursorColumn cterm=none ctermbg=238 ctermfg=none gui=none guibg=#424242
hi Title cterm=none ctermbg=none ctermfg=4 gui=none guifg=#88CCE7
hi VertSplit cterm=bold ctermbg=none ctermfg=8 gui=bold guibg=#282828 guifg=#8F8F8F
hi SignColumn cterm=bold ctermbg=none ctermfg=8 gui=bold guibg=#282828 guifg=#8F8F8F
" ----------------------------------------------------------------------------
" Syntax Highlighting
" ----------------------------------------------------------------------------
hi Keyword cterm=none ctermbg=none ctermfg=10 gui=none guifg=#D1FA71
hi Comment cterm=none ctermbg=none ctermfg=8 gui=none guifg=#8F8F8F
hi Delimiter cterm=none ctermbg=none ctermfg=15 gui=none guifg=#F7F7F7
hi Identifier cterm=none ctermbg=none ctermfg=12 gui=none guifg=#96D9F1
hi Structure cterm=none ctermbg=none ctermfg=12 gui=none guifg=#9DEEF2
hi Ignore cterm=none ctermbg=none ctermfg=8 gui=none guifg=bg
hi Constant cterm=none ctermbg=none ctermfg=12 gui=none guifg=#96D9F1
hi PreProc cterm=none ctermbg=none ctermfg=10 gui=none guifg=#D1FA71
hi Type cterm=none ctermbg=none ctermfg=12 gui=none guifg=#96D9F1
hi Statement cterm=none ctermbg=none ctermfg=10 gui=none guifg=#D1FA71
hi Special cterm=none ctermbg=none ctermfg=6 gui=none guifg=#d7d7d7
hi String cterm=none ctermbg=none ctermfg=3 gui=none guifg=#F6DC69
hi Number cterm=none ctermbg=none ctermfg=3 gui=none guifg=#F6DC69
hi Underlined cterm=none ctermbg=none ctermfg=magenta gui=underline guibg=#272727
hi Symbol cterm=none ctermbg=none ctermfg=9 gui=none guifg=#FAB1AB
hi Method cterm=none ctermbg=none ctermfg=15 gui=none guifg=#F7F7F7
hi Interpolation cterm=none ctermbg=none ctermfg=6 gui=none guifg=#2EB5C1
" Erlang
hi link erlangAtom Keyword
hi link erlangBitType Keyword
hi link rubyBeginend Keyword
hi link rubyClass Keyword
hi link rubyModule Keyword
hi link rubyKeyword Keyword
hi link rubyOperator Method
hi link rubyIdentifier Keyword
hi link rubyClassVariable Symbol
hi link rubyInstanceVariable Constant
hi link rubyGlobalVariable Constant
hi link rubyClassVariable Method
hi link rubyConstant Constant
hi link rubySymbol Symbol
hi link rubyFunction Constant
hi link rubyControl Keyword
hi link rubyConditional Keyword
hi link rubyInterpolation Interpolation
hi link rubyInterpolationDelimiter Interpolation
hi link rubyRailsMethod Method

View File

@ -1,74 +1,139 @@
" Vim syntax file " Vim syntax file
" Language: JSON " Language: JSON
" Maintainer: Jeroen Ruigrok van der Werven <asmodai@in-nomine.org> " Maintainer: Eli Parra <eli@elzr.com> https://github.com/elzr/vim-json
" Last Change: 2009-06-16 " Last Change: 2014-12-20 Load ftplugin/json.vim
" Version: 0.4
" {{{1
" Syntax setup {{{2 " Reload the definition of g:vim_json_syntax_conceal
" For version 5.x: Clear all syntax items " see https://github.com/elzr/vim-json/issues/42
" For version 6.x: Quit when a syntax file was already loaded runtime! ftplugin/json.vim
if !exists("main_syntax") if !exists("main_syntax")
if version < 600 if version < 600
syntax clear syntax clear
elseif exists("b:current_syntax") elseif exists("b:current_syntax")
finish finish
endif endif
let main_syntax = 'json' let main_syntax = 'json'
endif endif
" Syntax: Strings {{{2 syntax match jsonNoise /\%(:\|,\)/
syn region jsonString start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=jsonEscape
" Syntax: JSON does not allow strings with single quotes, unlike JavaScript.
syn region jsonStringSQ start=+'+ skip=+\\\\\|\\"+ end=+'+
" Syntax: Escape sequences {{{3 " NOTE that for the concealing to work your conceallevel should be set to 2
" Syntax: Strings
" Separated into a match and region because a region by itself is always greedy
syn match jsonStringMatch /"\([^"]\|\\\"\)\+"\ze[[:blank:]\r\n]*[,}\]]/ contains=jsonString
if has('conceal') && g:vim_json_syntax_conceal == 1
syn region jsonString oneline matchgroup=jsonQuote start=/"/ skip=/\\\\\|\\"/ end=/"/ concealends contains=jsonEscape contained
else
syn region jsonString oneline matchgroup=jsonQuote start=/"/ skip=/\\\\\|\\"/ end=/"/ contains=jsonEscape contained
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') && g:vim_json_syntax_conceal == 1
syn region jsonKeyword matchgroup=jsonQuote start=/"/ end=/"\ze[[:blank:]\r\n]*\:/ concealends contains=jsonEscape contained
else
syn region jsonKeyword matchgroup=jsonQuote start=/"/ end=/"\ze[[:blank:]\r\n]*\:/ contains=jsonEscape contained
endif
" Syntax: Escape sequences
syn match jsonEscape "\\["\\/bfnrt]" contained syn match jsonEscape "\\["\\/bfnrt]" contained
syn match jsonEscape "\\u\x\{4}" contained syn match jsonEscape "\\u\x\{4}" contained
" Syntax: Strings should always be enclosed with quotes. " Syntax: Numbers
syn match jsonNoQuotes "\<\a\+\>" syn match jsonNumber "-\=\<\%(0\|[1-9]\d*\)\%(\.\d\+\)\=\%([eE][-+]\=\d\+\)\=\>\ze[[:blank:]\r\n]*[,}\]]"
" Syntax: Numbers {{{2 " ERROR WARNINGS **********************************************
syn match jsonNumber "-\=\<\%(0\|[1-9]\d*\)\%(\.\d\+\)\=\%([eE][-+]\=\d\+\)\=\>" if (!exists("g:vim_json_warnings") || g:vim_json_warnings==1)
" Syntax: Strings should always be enclosed with quotes.
syn match jsonNoQuotesError "\<[[:alpha:]][[:alnum:]]*\>"
syn match jsonTripleQuotesError /"""/
" Syntax: An integer part of 0 followed by other digits is not allowed. " Syntax: An integer part of 0 followed by other digits is not allowed.
syn match jsonNumError "-\=\<0\d\.\d*\>" syn match jsonNumError "-\=\<0\d\.\d*\>"
" Syntax: Boolean {{{2 " Syntax: Decimals smaller than one should begin with 0 (so .1 should be 0.1).
syn keyword jsonBoolean true false syn match jsonNumError "\:\@<=[[:blank:]\r\n]*\zs\.\d\+"
" Syntax: Null {{{2 " Syntax: No comments in JSON, see http://stackoverflow.com/questions/244777/can-i-comment-a-json-file
syn keyword jsonNull null syn match jsonCommentError "//.*"
syn match jsonCommentError "\(/\*\)\|\(\*/\)"
" Syntax: Braces {{{2 " Syntax: No semicolons in JSON
syn match jsonBraces "[{}\[\]]" syn match jsonSemicolonError ";"
" Define the default highlighting. {{{1 " Syntax: No trailing comma after the last element of arrays or objects
" For version 5.7 and earlier: only when not done already syn match jsonTrailingCommaError ",\_s*[}\]]"
" For version 5.8 and later: only when an item doesn't have highlighting yet
if version >= 508 || !exists("did_json_syn_inits") " Syntax: Watch out for missing commas between elements
if version < 508 syn match jsonMissingCommaError /\("\|\]\|\d\)\zs\_s\+\ze"/
let did_json_syn_inits = 1 syn match jsonMissingCommaError /\(\]\|\}\)\_s\+\ze"/ "arrays/objects as values
command -nargs=+ HiLink hi link <args> if (expand('%:e') !=? 'jsonl')
else syn match jsonMissingCommaError /}\_s\+\ze{/ "objects as elements in an array
command -nargs=+ HiLink hi def link <args>
endif endif
HiLink jsonString String syn match jsonMissingCommaError /\(true\|false\)\_s\+\ze"/ "true/false as value
HiLink jsonEscape Special endif
HiLink jsonNumber Number
HiLink jsonBraces Operator
HiLink jsonNull Function
HiLink jsonBoolean Boolean
HiLink jsonNumError Error " ********************************************** END OF ERROR WARNINGS
HiLink jsonStringSQ Error " Allowances for JSONP: function call at the beginning of the file,
HiLink jsonNoQuotes Error " parenthesis and semicolon at the end.
delcommand HiLink " Function name validation based on
" http://stackoverflow.com/questions/2008279/validate-a-javascript-function-name/2008444#2008444
syn match jsonPadding "\%^[[:blank:]\r\n]*[_$[:alpha:]][_$[:alnum:]]*[[:blank:]\r\n]*("
syn match jsonPadding ");[[:blank:]\r\n]*\%$"
" Syntax: Boolean
syn match jsonBoolean /\(true\|false\)\(\_s\+\ze"\)\@!/
" Syntax: Null
syn keyword jsonNull null
" Syntax: Braces
syn region jsonFold matchgroup=jsonBraces start="{" end=/}\(\_s\+\ze\("\|{\)\)\@!/ transparent fold
syn region jsonFold matchgroup=jsonBraces start="\[" end=/]\(\_s\+\ze"\)\@!/ transparent fold
" Define the default highlighting.
if version >= 508 || !exists("did_json_syn_inits")
hi def link jsonPadding Operator
hi def link jsonString String
hi def link jsonTest Label
hi def link jsonEscape Special
hi def link jsonNumber Number
hi def link jsonBraces Delimiter
hi def link jsonNull Function
hi def link jsonBoolean Boolean
hi def link jsonKeyword Label
if (!exists("g:vim_json_warnings") || g:vim_json_warnings==1)
hi def link jsonNumError Error
hi def link jsonCommentError Error
hi def link jsonSemicolonError Error
hi def link jsonTrailingCommaError Error
hi def link jsonMissingCommaError Error
hi def link jsonStringSQError Error
hi def link jsonNoQuotesError Error
hi def link jsonTripleQuotesError Error
endif
hi def link jsonQuote Quote
hi def link jsonNoise Noise
endif endif
let b:current_syntax = "json" let b:current_syntax = "json"
if main_syntax == 'json' if main_syntax == 'json'
unlet main_syntax unlet main_syntax
endif endif
" Vim settings
" vim: ts=8 fdm=marker
" MIT License
" Copyright (c) 2013, Jeroen Ruigrok van der Werven, Eli Parra
"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.
"See https://twitter.com/elzr/status/294964017926119424

View File

@ -79,6 +79,7 @@ deploy)
# Copy color vim scheme from init folder to .vim/colors # Copy color vim scheme from init folder to .vim/colors
cp init/Smyck-Color-Scheme/smyck.vim .vim/colors/smyck.vim cp init/Smyck-Color-Scheme/smyck.vim .vim/colors/smyck.vim
cp init/vim-json/json.vim .vim/syntax/json.vim
df_deploy df_deploy
;; ;;

1
init/vim-json Submodule

@ -0,0 +1 @@
Subproject commit 3727f089410e23ae113be6222e8a08dd2613ecf2