mirror of
https://github.com/sheerun/vim-polyglot.git
synced 2025-11-11 13:03:50 -05:00
Update latex, csv, handlebars and rust
This commit is contained in:
@@ -1,2 +1,4 @@
|
|||||||
" adds support for cleverref package (`\cref` and `\Cref`)
|
" adds support for cleverref package
|
||||||
syn region texRefZone matchgroup=texStatement start="\\\(c\|C\)ref{" end="}\|%stopzone\>" contains=@texRefGroup
|
" \Cref, \cref, \cpageref, \labelcref, \labelcpageref
|
||||||
|
syn region texRefZone matchgroup=texStatement start="\\Cref{" end="}\|%stopzone\>" contains=@texRefGroup
|
||||||
|
syn region texRefZone matchgroup=texStatement start="\\\(label\|\)c\(page\|\)ref{" end="}\|%stopzone\>" contains=@texRefGroup
|
||||||
|
|||||||
@@ -11,10 +11,10 @@
|
|||||||
" though, implementation differs.
|
" though, implementation differs.
|
||||||
|
|
||||||
" Plugin folklore "{{{2
|
" Plugin folklore "{{{2
|
||||||
if v:version < 700 || exists('b:did_ftplugin')
|
if v:version < 700 || exists('b:did_csv_ftplugin')
|
||||||
finish
|
finish
|
||||||
endif
|
endif
|
||||||
let b:did_ftplugin = 1
|
let b:did_csv_ftplugin = 1
|
||||||
|
|
||||||
let s:cpo_save = &cpo
|
let s:cpo_save = &cpo
|
||||||
set cpo&vim
|
set cpo&vim
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ if !exists('g:LatexBox_cite_pattern')
|
|||||||
let g:LatexBox_cite_pattern = '\C\\\a*cite\a*\*\?\(\[[^\]]*\]\)*\_\s*{'
|
let g:LatexBox_cite_pattern = '\C\\\a*cite\a*\*\?\(\[[^\]]*\]\)*\_\s*{'
|
||||||
endif
|
endif
|
||||||
if !exists('g:LatexBox_ref_pattern')
|
if !exists('g:LatexBox_ref_pattern')
|
||||||
let g:LatexBox_ref_pattern = '\C\\v\?\(eq\|page\|[cC]\)\?ref\*\?\_\s*{'
|
let g:LatexBox_ref_pattern = '\C\\v\?\(eq\|page\|[cC]\|labelc\)\?ref\*\?\_\s*{'
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if !exists('g:LatexBox_completion_environments')
|
if !exists('g:LatexBox_completion_environments')
|
||||||
@@ -253,9 +253,12 @@ function! LatexBox_BibSearch(regexp)
|
|||||||
\ '\bibdata{' . bibdata . '}'], auxfile)
|
\ '\bibdata{' . bibdata . '}'], auxfile)
|
||||||
|
|
||||||
if has('win32')
|
if has('win32')
|
||||||
|
let l:old_shellslash = &l:shellslash
|
||||||
|
setlocal noshellslash
|
||||||
silent execute '! cd ' shellescape(LatexBox_GetTexRoot()) .
|
silent execute '! cd ' shellescape(LatexBox_GetTexRoot()) .
|
||||||
\ ' & bibtex -terse '
|
\ ' & bibtex -terse '
|
||||||
\ . fnamemodify(auxfile, ':t') . ' >nul'
|
\ . fnamemodify(auxfile, ':t') . ' >nul'
|
||||||
|
let &l:shellslash = l:old_shellslash
|
||||||
else
|
else
|
||||||
silent execute '! cd ' shellescape(LatexBox_GetTexRoot()) .
|
silent execute '! cd ' shellescape(LatexBox_GetTexRoot()) .
|
||||||
\ ' ; bibtex -terse '
|
\ ' ; bibtex -terse '
|
||||||
@@ -269,6 +272,8 @@ function! LatexBox_BibSearch(regexp)
|
|||||||
let matches = matchlist(line,
|
let matches = matchlist(line,
|
||||||
\ '^\(.*\)||\(.*\)||\(.*\)||\(.*\)||\(.*\)')
|
\ '^\(.*\)||\(.*\)||\(.*\)||\(.*\)||\(.*\)')
|
||||||
if !empty(matches) && !empty(matches[1])
|
if !empty(matches) && !empty(matches[1])
|
||||||
|
let s:type_length = max([s:type_length,
|
||||||
|
\ len(matches[2]) + 3])
|
||||||
call add(res, {
|
call add(res, {
|
||||||
\ 'key': matches[1],
|
\ 'key': matches[1],
|
||||||
\ 'type': matches[2],
|
\ 'type': matches[2],
|
||||||
@@ -305,6 +310,7 @@ endfunction
|
|||||||
" }}}
|
" }}}
|
||||||
|
|
||||||
" BibTeX completion {{{
|
" BibTeX completion {{{
|
||||||
|
let s:type_length=0
|
||||||
function! LatexBox_BibComplete(regexp)
|
function! LatexBox_BibComplete(regexp)
|
||||||
|
|
||||||
" treat spaces as '.*' if needed
|
" treat spaces as '.*' if needed
|
||||||
@@ -316,9 +322,12 @@ function! LatexBox_BibComplete(regexp)
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
let res = []
|
let res = []
|
||||||
|
let s:type_length = 4
|
||||||
for m in LatexBox_BibSearch(regexp)
|
for m in LatexBox_BibSearch(regexp)
|
||||||
let type = m['type'] == '' ? '[-]' : '[' . m['type'] . '] '
|
let type = m['type'] == '' ? '[-]' : '[' . m['type'] . '] '
|
||||||
|
let type = printf('%-' . s:type_length . 's', type)
|
||||||
let auth = m['author'] == '' ? '' : m['author'][:20] . ' '
|
let auth = m['author'] == '' ? '' : m['author'][:20] . ' '
|
||||||
|
let auth = substitute(auth, '\~', ' ', 'g')
|
||||||
let year = m['year'] == '' ? '' : '(' . m['year'] . ')'
|
let year = m['year'] == '' ? '' : '(' . m['year'] . ')'
|
||||||
let w = { 'word': m['key'],
|
let w = { 'word': m['key'],
|
||||||
\ 'abbr': type . auth . year,
|
\ 'abbr': type . auth . year,
|
||||||
|
|||||||
@@ -19,29 +19,39 @@ ru! syntax/html.vim
|
|||||||
unlet b:current_syntax
|
unlet b:current_syntax
|
||||||
|
|
||||||
|
|
||||||
|
syn region hbsInside start=/{{/ end=/}}/ keepend
|
||||||
|
|
||||||
syn keyword hbsTodo TODO FIXME XXX contained
|
syn keyword hbsTodo TODO FIXME XXX contained
|
||||||
|
|
||||||
syn match hbsError /}}}\?/
|
syn match hbsError /}}}\?/
|
||||||
syn match hbsInsideError /{{[{#<>=!\/]\?/ containedin=@hbsInside
|
syn match hbsInsideError /{{[{#<>=!\/]\?/ contained containedin=@hbsInside
|
||||||
|
|
||||||
syn cluster htmlHbsContainer add=htmlHead,htmlTitle,htmlString,htmlH1,htmlH2,htmlH3,htmlH4,htmlH5,htmlH6
|
syn match hbsHandlebars "{{\|}}" contained containedin=hbsInside
|
||||||
syn region hbsInside start=/{{/ end=/}}/ keepend transparent containedin=@htmlHbsContainer
|
syn match hbsUnescape "{{{\|}}}" contained containedin=hbsInside extend
|
||||||
|
syn match hbsOperators "=\|\.\|/" contained containedin=hbsInside
|
||||||
|
|
||||||
syn match hbsHandlebars "{{\|}}" containedin=hbsInside
|
syn region hbsSection start="{{[#/]"lc=2 end=/}}/me=e-2 contained containedin=hbsInside
|
||||||
syn match hbsUnescape "{{{\|}}}" containedin=hbsInside
|
syn region hbsPartial start=/{{[<>]/lc=2 end=/}}/me=e-2 contained containedin=hbsInside
|
||||||
syn match hbsOperators "=\|\.\|/" containedin=hbsInside
|
syn region hbsMarkerSet start=/{{=/lc=2 end=/=}}/me=e-2 contained containedin=hbsInside
|
||||||
|
|
||||||
syn region hbsSection start="{{[#/]"lc=2 end=/}}/me=e-2 containedin=hbsInside
|
syn region hbsComment start=/{{!/rs=s+2 end=/}}/re=e-2 contained containedin=hbsInside contains=hbsTodo,Todo
|
||||||
syn region hbsPartial start=/{{[<>]/lc=2 end=/}}/me=e-2 containedin=hbsInside
|
syn region hbsBlockComment start=/{{!--/rs=s+2 end=/--}}/re=e-2 contained containedin=hbsInside contains=hbsTodo,Todo extend
|
||||||
syn region hbsMarkerSet start=/{{=/lc=2 end=/=}}/me=e-2 containedin=hbsInside
|
syn region hbsQString start=/'/ skip=/\\'/ end=/'/ contained containedin=hbsInside
|
||||||
|
syn region hbsDQString start=/"/ skip=/\\"/ end=/"/ contained containedin=hbsInside
|
||||||
|
|
||||||
syn region hbsComment start=/{{!/rs=s+2 end=/}}/re=e-2 containedin=htmlHead contains=hbsTodo,Todo
|
syn match hbsConditionals "\([/#]\(if\|unless\)\|else\)" contained containedin=hbsInside
|
||||||
syn region hbsBlockComment start=/{{!--/rs=s+2 end=/--}}/re=e-2 containedin=htmlHead contains=hbsTodo,Todo
|
syn match hbsHelpers "[/#]\(with\|each\)" contained containedin=hbsInside
|
||||||
syn region hbsQString start=/'/ skip=/\\'/ end=/'/ containedin=hbsInside
|
|
||||||
syn region hbsDQString start=/"/ skip=/\\"/ end=/"/ containedin=hbsInside
|
|
||||||
|
|
||||||
syn match hbsConditionals "\([/#]\(if\|unless\)\|else\)" containedin=hbsInside
|
syn cluster allHbsItems add=hbsTodo,hbsError,hbsInsideError,hbsInside,hbsHandlebars,
|
||||||
syn match hbsHelpers "[/#]\(with\|each\)" containedin=hbsInside
|
\ hbsUnescape,hbsOperators,hbsSection,hbsPartial,hbsMarkerSet,
|
||||||
|
\ hbsComment,hbsBlockComment,hbsQString,hbsDQString,hbsConditionals,
|
||||||
|
\ hbsHelpers,hbsPartial,hbsMarkerSet,hbsComment,hbsBlockComment,
|
||||||
|
\ hbsQString,hbsDQString,hbsConditionals,hbsHelpers
|
||||||
|
|
||||||
|
syn cluster htmlAdditional add=htmlTag,htmlEndTag,htmlTagName,htmlSpecialChar
|
||||||
|
|
||||||
|
syn region hbsScriptTemplate start=+<script [^>]*type *=[^>]*text/x-handlebars-template[^>]*>+
|
||||||
|
\ end=+</script>+me=s-1 keepend contains=@htmlHbsContainer,@allHbsItems,@htmlAdditional
|
||||||
|
|
||||||
|
|
||||||
" Define the default highlighting.
|
" Define the default highlighting.
|
||||||
|
|||||||
@@ -148,6 +148,7 @@ syn match rustFormat display "%%" contained
|
|||||||
syn match rustSpecial display contained /\\\([nrt\\'"]\|x\x\{2}\|u\x\{4}\|U\x\{8}\)/
|
syn match rustSpecial display contained /\\\([nrt\\'"]\|x\x\{2}\|u\x\{4}\|U\x\{8}\)/
|
||||||
syn match rustStringContinuation display contained /\\\n\s*/
|
syn match rustStringContinuation display contained /\\\n\s*/
|
||||||
syn region rustString start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=rustTodo,rustFormat,rustSpecial,rustStringContinuation
|
syn region rustString start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=rustTodo,rustFormat,rustSpecial,rustStringContinuation
|
||||||
|
syn region rustString start='r\z(#*\)"' end='"\z1'
|
||||||
|
|
||||||
syn region rustAttribute start="#\[" end="\]" contains=rustString,rustDeriving
|
syn region rustAttribute start="#\[" end="\]" contains=rustString,rustDeriving
|
||||||
syn region rustDeriving start="deriving(" end=")" contained contains=rustTrait
|
syn region rustDeriving start="deriving(" end=")" contained contains=rustTrait
|
||||||
|
|||||||
Reference in New Issue
Block a user