mirror of
https://github.com/sheerun/vim-polyglot.git
synced 2025-11-08 11:33:52 -05:00
Update
This commit is contained in:
@@ -63,6 +63,8 @@ function! s:input(fname, type) abort " {{{1
|
|||||||
if l:lnum == 0 | return a:fname | endif
|
if l:lnum == 0 | return a:fname | endif
|
||||||
|
|
||||||
let l:cmd = vimtex#cmd#get_at(l:lnum, l:cnum)
|
let l:cmd = vimtex#cmd#get_at(l:lnum, l:cnum)
|
||||||
|
if empty(l:cmd) | return a:fname | endif
|
||||||
|
|
||||||
let l:file = join(map(
|
let l:file = join(map(
|
||||||
\ get(l:cmd, 'args', [{}]),
|
\ get(l:cmd, 'args', [{}]),
|
||||||
\ "get(v:val, 'text', '')"),
|
\ "get(v:val, 'text', '')"),
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ let g:vimtex#re#tex_input_import =
|
|||||||
let g:vimtex#re#tex_input_package =
|
let g:vimtex#re#tex_input_package =
|
||||||
\ '\v\\%(usepackage|RequirePackage)%(\s*\[[^]]*\])?\s*\{\zs[^}]*\ze\}'
|
\ '\v\\%(usepackage|RequirePackage)%(\s*\[[^]]*\])?\s*\{\zs[^}]*\ze\}'
|
||||||
|
|
||||||
let g:vimtex#re#tex_input = '\v^\s*%(' . join([
|
let g:vimtex#re#tex_input = '\v^\s*\zs%(' . join([
|
||||||
\ g:vimtex#re#tex_input_latex,
|
\ g:vimtex#re#tex_input_latex,
|
||||||
\ g:vimtex#re#tex_input_import,
|
\ g:vimtex#re#tex_input_import,
|
||||||
\ ], '|') . ')'
|
\ ], '|') . ')'
|
||||||
|
|||||||
@@ -7,6 +7,8 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'latex') == -1
|
|||||||
"
|
"
|
||||||
|
|
||||||
function! vimtex#syntax#load#general() abort " {{{1
|
function! vimtex#syntax#load#general() abort " {{{1
|
||||||
|
if !exists('b:vimtex_syntax') | return | endif
|
||||||
|
|
||||||
" I don't see why we can't match Math zones in the MatchNMGroup
|
" I don't see why we can't match Math zones in the MatchNMGroup
|
||||||
if !exists('g:tex_no_math')
|
if !exists('g:tex_no_math')
|
||||||
syntax cluster texMatchNMGroup add=@texMathZones
|
syntax cluster texMatchNMGroup add=@texMathZones
|
||||||
@@ -64,6 +66,8 @@ endfunction
|
|||||||
|
|
||||||
" }}}1
|
" }}}1
|
||||||
function! vimtex#syntax#load#packages() abort " {{{1
|
function! vimtex#syntax#load#packages() abort " {{{1
|
||||||
|
if !exists('b:vimtex_syntax') | return | endif
|
||||||
|
|
||||||
try
|
try
|
||||||
call vimtex#syntax#p#{b:vimtex.documentclass}#load()
|
call vimtex#syntax#p#{b:vimtex.documentclass}#load()
|
||||||
catch /E117:/
|
catch /E117:/
|
||||||
|
|||||||
@@ -153,9 +153,10 @@ function! s:xwin_template.xwin_exists() dict abort " {{{1
|
|||||||
" If xwin_id is unset, check if matching viewer windows exist
|
" If xwin_id is unset, check if matching viewer windows exist
|
||||||
"
|
"
|
||||||
if self.xwin_id == 0
|
if self.xwin_id == 0
|
||||||
if has_key(self, 'get_pid')
|
let l:pid = has_key(self, 'get_pid') ? self.get_pid() : 0
|
||||||
|
if l:pid > 0
|
||||||
let cmd = 'xdotool search'
|
let cmd = 'xdotool search'
|
||||||
\ . ' --all --pid ' . self.get_pid()
|
\ . ' --all --pid ' . l:pid
|
||||||
\ . ' --name ' . fnamemodify(self.out(), ':t')
|
\ . ' --name ' . fnamemodify(self.out(), ':t')
|
||||||
let self.xwin_id = get(split(system(cmd), '\n'), 0)
|
let self.xwin_id = get(split(system(cmd), '\n'), 0)
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -90,21 +90,20 @@ function! s:zathura.compiler_callback(status) dict abort " {{{1
|
|||||||
|
|
||||||
if !filereadable(self.out()) | return | endif
|
if !filereadable(self.out()) | return | endif
|
||||||
|
|
||||||
if g:vimtex_view_automatic
|
if g:vimtex_view_automatic && !has_key(self, 'started_through_callback')
|
||||||
"
|
"
|
||||||
" Search for existing window created by latexmk
|
" Search for existing window created by latexmk
|
||||||
" It may be necessary to wait some time before it is opened and
|
" Note: It may be necessary to wait some time before it is opened and
|
||||||
" recognized. Sometimes it is very quick, other times it may take
|
" recognized. Sometimes it is very quick, other times it may take
|
||||||
" a second. This way, we don't block longer than necessary.
|
" a second. This way, we don't block longer than necessary.
|
||||||
"
|
"
|
||||||
if !has_key(self, 'started_through_callback')
|
for l:dummy in range(30)
|
||||||
for l:dummy in range(30)
|
let l:xwin_exists = self.xwin_exists()
|
||||||
sleep 50m
|
if l:xwin_exists | break | endif
|
||||||
if self.xwin_exists() | break | endif
|
sleep 50m
|
||||||
endfor
|
endfor
|
||||||
endif
|
|
||||||
|
|
||||||
if !self.xwin_exists() && !has_key(self, 'started_through_callback')
|
if ! l:xwin_exists
|
||||||
call self.start(self.out())
|
call self.start(self.out())
|
||||||
let self.started_through_callback = 1
|
let self.started_through_callback = 1
|
||||||
endif
|
endif
|
||||||
|
|||||||
@@ -1639,6 +1639,7 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'zig') == -1
|
|||||||
augroup filetypedetect
|
augroup filetypedetect
|
||||||
" zig, from zig.vim in ziglang/zig.vim
|
" zig, from zig.vim in ziglang/zig.vim
|
||||||
au BufRead,BufNewFile *.zig set filetype=zig
|
au BufRead,BufNewFile *.zig set filetype=zig
|
||||||
|
au BufRead,BufNewFile *.zir set filetype=zir
|
||||||
augroup end
|
augroup end
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ setlocal tabstop=4
|
|||||||
setlocal shiftwidth=4
|
setlocal shiftwidth=4
|
||||||
|
|
||||||
setlocal suffixesadd=.zig
|
setlocal suffixesadd=.zig
|
||||||
|
setlocal suffixesadd=.zir
|
||||||
setlocal commentstring=//\ %s
|
setlocal commentstring=//\ %s
|
||||||
setlocal makeprg=zig\ build
|
setlocal makeprg=zig\ build
|
||||||
|
|
||||||
|
|||||||
@@ -53,8 +53,8 @@ syntax keyword jsFrom contained from skipwhite skipempty nextgroup
|
|||||||
syntax match jsModuleComma contained /,/ skipwhite skipempty nextgroup=jsModuleKeyword,jsModuleAsterisk,jsModuleGroup,jsFlowTypeKeyword
|
syntax match jsModuleComma contained /,/ skipwhite skipempty nextgroup=jsModuleKeyword,jsModuleAsterisk,jsModuleGroup,jsFlowTypeKeyword
|
||||||
|
|
||||||
" Strings, Templates, Numbers
|
" Strings, Templates, Numbers
|
||||||
syntax region jsString start=+\z(["']\)+ skip=+\\\%(\z1\|$\)+ end=+\z1+ end=+$+ contains=jsSpecial,@Spell extend
|
syntax region jsString start=+\z(["']\)+ skip=+\\\%(\z1\|$\)+ end=+\z1+ end=+$+ contains=jsSpecial extend
|
||||||
syntax region jsTemplateString start=+`+ skip=+\\`+ end=+`+ contains=jsTemplateExpression,jsSpecial,@Spell extend
|
syntax region jsTemplateString start=+`+ skip=+\\`+ end=+`+ contains=jsTemplateExpression,jsSpecial extend
|
||||||
syntax match jsTaggedTemplate /\<\K\k*\ze`/ nextgroup=jsTemplateString
|
syntax match jsTaggedTemplate /\<\K\k*\ze`/ nextgroup=jsTemplateString
|
||||||
syntax match jsNumber /\c\<\%(\d\+\%(e[+-]\=\d\+\)\=\|0b[01]\+\|0o\o\+\|0x\x\+\)\>/
|
syntax match jsNumber /\c\<\%(\d\+\%(e[+-]\=\d\+\)\=\|0b[01]\+\|0o\o\+\|0x\x\+\)\>/
|
||||||
syntax keyword jsNumber Infinity
|
syntax keyword jsNumber Infinity
|
||||||
@@ -76,14 +76,14 @@ syntax cluster jsRegexpSpecial contains=jsSpecial,jsRegexpBoundary,jsRegexpBa
|
|||||||
" Objects
|
" Objects
|
||||||
syntax match jsObjectShorthandProp contained /\<\k*\ze\s*/ skipwhite skipempty nextgroup=jsObjectSeparator
|
syntax match jsObjectShorthandProp contained /\<\k*\ze\s*/ skipwhite skipempty nextgroup=jsObjectSeparator
|
||||||
syntax match jsObjectKey contained /\<\k*\ze\s*:/ contains=jsFunctionKey skipwhite skipempty nextgroup=jsObjectValue
|
syntax match jsObjectKey contained /\<\k*\ze\s*:/ contains=jsFunctionKey skipwhite skipempty nextgroup=jsObjectValue
|
||||||
syntax region jsObjectKeyString contained start=+\z(["']\)+ skip=+\\\%(\z1\|$\)+ end=+\z1\|$+ contains=jsSpecial,@Spell skipwhite skipempty nextgroup=jsObjectValue
|
syntax region jsObjectKeyString contained start=+\z(["']\)+ skip=+\\\%(\z1\|$\)+ end=+\z1\|$+ contains=jsSpecial skipwhite skipempty nextgroup=jsObjectValue
|
||||||
syntax region jsObjectKeyComputed contained matchgroup=jsBrackets start=/\[/ end=/]/ contains=@jsExpression skipwhite skipempty nextgroup=jsObjectValue,jsFuncArgs extend
|
syntax region jsObjectKeyComputed contained matchgroup=jsBrackets start=/\[/ end=/]/ contains=@jsExpression skipwhite skipempty nextgroup=jsObjectValue,jsFuncArgs extend
|
||||||
syntax match jsObjectSeparator contained /,/
|
syntax match jsObjectSeparator contained /,/
|
||||||
syntax region jsObjectValue contained matchgroup=jsObjectColon start=/:/ end=/[,}]\@=/ contains=@jsExpression extend
|
syntax region jsObjectValue contained matchgroup=jsObjectColon start=/:/ end=/[,}]\@=/ contains=@jsExpression extend
|
||||||
syntax match jsObjectFuncName contained /\<\K\k*\ze\_s*(/ skipwhite skipempty nextgroup=jsFuncArgs
|
syntax match jsObjectFuncName contained /\<\K\k*\ze\_s*(/ skipwhite skipempty nextgroup=jsFuncArgs
|
||||||
syntax match jsFunctionKey contained /\<\K\k*\ze\s*:\s*function\>/
|
syntax match jsFunctionKey contained /\<\K\k*\ze\s*:\s*function\>/
|
||||||
syntax match jsObjectMethodType contained /\<[gs]et\ze\s\+\K\k*/ skipwhite skipempty nextgroup=jsObjectFuncName
|
syntax match jsObjectMethodType contained /\<[gs]et\ze\s\+\K\k*/ skipwhite skipempty nextgroup=jsObjectFuncName
|
||||||
syntax region jsObjectStringKey contained start=+\z(["']\)+ skip=+\\\%(\z1\|$\)+ end=+\z1\|$+ contains=jsSpecial,@Spell extend skipwhite skipempty nextgroup=jsFuncArgs,jsObjectValue
|
syntax region jsObjectStringKey contained start=+\z(["']\)+ skip=+\\\%(\z1\|$\)+ end=+\z1\|$+ contains=jsSpecial extend skipwhite skipempty nextgroup=jsFuncArgs,jsObjectValue
|
||||||
|
|
||||||
exe 'syntax keyword jsNull null '.(exists('g:javascript_conceal_null') ? 'conceal cchar='.g:javascript_conceal_null : '')
|
exe 'syntax keyword jsNull null '.(exists('g:javascript_conceal_null') ? 'conceal cchar='.g:javascript_conceal_null : '')
|
||||||
exe 'syntax keyword jsReturn return contained '.(exists('g:javascript_conceal_return') ? 'conceal cchar='.g:javascript_conceal_return : '').' skipwhite nextgroup=@jsExpression'
|
exe 'syntax keyword jsReturn return contained '.(exists('g:javascript_conceal_return') ? 'conceal cchar='.g:javascript_conceal_return : '').' skipwhite nextgroup=@jsExpression'
|
||||||
@@ -189,7 +189,7 @@ syntax region jsClassDefinition start=/\<class\>/ end=/\(\<ext
|
|||||||
syntax match jsClassProperty contained /\<\K\k*\ze\s*[=;]/ skipwhite skipempty nextgroup=jsClassValue,jsFlowClassDef
|
syntax match jsClassProperty contained /\<\K\k*\ze\s*[=;]/ skipwhite skipempty nextgroup=jsClassValue,jsFlowClassDef
|
||||||
syntax region jsClassValue contained start=/=/ end=/\_[;}]\@=/ contains=@jsExpression
|
syntax region jsClassValue contained start=/=/ end=/\_[;}]\@=/ contains=@jsExpression
|
||||||
syntax region jsClassPropertyComputed contained matchgroup=jsBrackets start=/\[/ end=/]/ contains=@jsExpression skipwhite skipempty nextgroup=jsFuncArgs,jsClassValue extend
|
syntax region jsClassPropertyComputed contained matchgroup=jsBrackets start=/\[/ end=/]/ contains=@jsExpression skipwhite skipempty nextgroup=jsFuncArgs,jsClassValue extend
|
||||||
syntax region jsClassStringKey contained start=+\z(["']\)+ skip=+\\\%(\z1\|$\)+ end=+\z1\|$+ contains=jsSpecial,@Spell extend skipwhite skipempty nextgroup=jsFuncArgs
|
syntax region jsClassStringKey contained start=+\z(["']\)+ skip=+\\\%(\z1\|$\)+ end=+\z1\|$+ contains=jsSpecial extend skipwhite skipempty nextgroup=jsFuncArgs
|
||||||
|
|
||||||
" Destructuring
|
" Destructuring
|
||||||
syntax match jsDestructuringPropertyValue contained /\k\+/
|
syntax match jsDestructuringPropertyValue contained /\k\+/
|
||||||
|
|||||||
@@ -46,11 +46,11 @@ syn match zigBuiltinFn "\v\@(truncate|typeInfo|typeName|TypeOf|atomicRmw|bytesTo
|
|||||||
syn match zigBuiltinFn "\v\@(intToError|errorToInt|intToEnum|enumToInt|setAlignStack|frame|Frame|frameSize|bitReverse|Vector)>"
|
syn match zigBuiltinFn "\v\@(intToError|errorToInt|intToEnum|enumToInt|setAlignStack|frame|Frame|frameSize|bitReverse|Vector)>"
|
||||||
syn match zigBuiltinFn "\v\@(sin|cos|exp|exp2|log|log2|log10|fabs|floor|ceil|trunc|round)>"
|
syn match zigBuiltinFn "\v\@(sin|cos|exp|exp2|log|log2|log10|fabs|floor|ceil|trunc|round)>"
|
||||||
|
|
||||||
syn match zigDecNumber display "\<[0-9]\+\%(.[0-9]\+\)\=\%([eE][+-]\?[0-9]\+\)\="
|
" 12_34 (. but not ..)? (12_34)? (exponent 12_34)?
|
||||||
syn match zigHexNumber display "\<0x[a-fA-F0-9]\+\%([a-fA-F0-9]\+\%([pP][+-]\?[0-9]\+\)\?\)\="
|
syn match zigDecNumber display "\v<\d%(_?\d)*%(\.\.@!)?%(\d%(_?\d)*)?%([eE][+-]?\d%(_?\d)*)?"
|
||||||
syn match zigOctNumber display "\<0o[0-7]\+"
|
syn match zigHexNumber display "\v<0x\x%(_?\x)*%(\.\.@!)?%(\x%(_?\x)*)?%([pP][+-]?\d%(_?\d)*)?"
|
||||||
syn match zigBinNumber display "\<0b[01]\+\%(.[01]\+\%([eE][+-]\?[0-9]\+\)\?\)\="
|
syn match zigOctNumber display "\v<0o\o%(_?\o)*"
|
||||||
|
syn match zigBinNumber display "\v<0b[01]%(_?[01])*"
|
||||||
|
|
||||||
syn match zigCharacterInvalid display contained /b\?'\zs[\n\r\t']\ze'/
|
syn match zigCharacterInvalid display contained /b\?'\zs[\n\r\t']\ze'/
|
||||||
syn match zigCharacterInvalidUnicode display contained /b'\zs[^[:cntrl:][:graph:][:alnum:][:space:]]\ze'/
|
syn match zigCharacterInvalidUnicode display contained /b'\zs[^[:cntrl:][:graph:][:alnum:][:space:]]\ze'/
|
||||||
|
|||||||
54
syntax/zir.vim
Normal file
54
syntax/zir.vim
Normal file
@@ -0,0 +1,54 @@
|
|||||||
|
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'zig') == -1
|
||||||
|
|
||||||
|
" Vim syntax file
|
||||||
|
" Language: Zir
|
||||||
|
" Maintainer: Andrew Kelley
|
||||||
|
" Latest Revision: 00 April 2020
|
||||||
|
|
||||||
|
if exists("b:current_syntax")
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
let b:current_syntax = "zir"
|
||||||
|
|
||||||
|
syn region zirCommentLine start=";" end="$" contains=zirTodo,@Spell
|
||||||
|
|
||||||
|
syn region zirBlock start="{" end="}" transparent fold
|
||||||
|
|
||||||
|
syn keyword zirKeyword primitive fntype int str as ptrtoint fieldptr deref asm unreachable export
|
||||||
|
|
||||||
|
syn keyword zirTodo contained TODO
|
||||||
|
|
||||||
|
syn region zirString start=+c\?"+ skip=+\\\\\|\\"+ end=+"+ oneline contains=zirEscape,zirEscapeUnicode,zirEscapeError,@Spell
|
||||||
|
|
||||||
|
syn match zirEscapeError display contained /\\./
|
||||||
|
syn match zirEscape display contained /\\\([nrt\\'"]\|x\x\{2}\)/
|
||||||
|
syn match zirEscapeUnicode display contained /\\\(u\x\{4}\|U\x\{6}\)/
|
||||||
|
|
||||||
|
syn match zirDecNumber display "\<[0-9]\+\%(.[0-9]\+\)\=\%([eE][+-]\?[0-9]\+\)\="
|
||||||
|
syn match zirHexNumber display "\<0x[a-fA-F0-9]\+\%([a-fA-F0-9]\+\%([pP][+-]\?[0-9]\+\)\?\)\="
|
||||||
|
syn match zirOctNumber display "\<0o[0-7]\+"
|
||||||
|
syn match zirBinNumber display "\<0b[01]\+\%(.[01]\+\%([eE][+-]\?[0-9]\+\)\?\)\="
|
||||||
|
|
||||||
|
syn match zirGlobal display "[^a-zA-Z0-9_]\?\zs@[a-zA-Z0-9_]\+"
|
||||||
|
syn match zirLocal display "[^a-zA-Z0-9_]\?\zs%[a-zA-Z0-9_]\+"
|
||||||
|
|
||||||
|
hi def link zirCommentLine Comment
|
||||||
|
hi def link zirTodo Todo
|
||||||
|
|
||||||
|
hi def link zirKeyword Keyword
|
||||||
|
|
||||||
|
hi def link zirString Constant
|
||||||
|
|
||||||
|
hi def link zirEscape Special
|
||||||
|
hi def link zirEscapeUnicode zirEscape
|
||||||
|
hi def link zirEscapeError Error
|
||||||
|
|
||||||
|
hi def link zirDecNumber Constant
|
||||||
|
hi def link zirHexNumber Constant
|
||||||
|
hi def link zirOctNumber Constant
|
||||||
|
hi def link zirBinNumber Constant
|
||||||
|
|
||||||
|
hi def link zirGlobal Ignore
|
||||||
|
hi def link zirLocal Identifier
|
||||||
|
|
||||||
|
endif
|
||||||
Reference in New Issue
Block a user