mirror of
https://github.com/sheerun/vim-polyglot.git
synced 2025-11-10 20:43:52 -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`)
|
||||
syn region texRefZone matchgroup=texStatement start="\\\(c\|C\)ref{" end="}\|%stopzone\>" contains=@texRefGroup
|
||||
" adds support for cleverref package
|
||||
" \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.
|
||||
|
||||
" Plugin folklore "{{{2
|
||||
if v:version < 700 || exists('b:did_ftplugin')
|
||||
if v:version < 700 || exists('b:did_csv_ftplugin')
|
||||
finish
|
||||
endif
|
||||
let b:did_ftplugin = 1
|
||||
let b:did_csv_ftplugin = 1
|
||||
|
||||
let s:cpo_save = &cpo
|
||||
set cpo&vim
|
||||
|
||||
@@ -24,7 +24,7 @@ if !exists('g:LatexBox_cite_pattern')
|
||||
let g:LatexBox_cite_pattern = '\C\\\a*cite\a*\*\?\(\[[^\]]*\]\)*\_\s*{'
|
||||
endif
|
||||
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
|
||||
|
||||
if !exists('g:LatexBox_completion_environments')
|
||||
@@ -253,9 +253,12 @@ function! LatexBox_BibSearch(regexp)
|
||||
\ '\bibdata{' . bibdata . '}'], auxfile)
|
||||
|
||||
if has('win32')
|
||||
let l:old_shellslash = &l:shellslash
|
||||
setlocal noshellslash
|
||||
silent execute '! cd ' shellescape(LatexBox_GetTexRoot()) .
|
||||
\ ' & bibtex -terse '
|
||||
\ . fnamemodify(auxfile, ':t') . ' >nul'
|
||||
let &l:shellslash = l:old_shellslash
|
||||
else
|
||||
silent execute '! cd ' shellescape(LatexBox_GetTexRoot()) .
|
||||
\ ' ; bibtex -terse '
|
||||
@@ -269,6 +272,8 @@ function! LatexBox_BibSearch(regexp)
|
||||
let matches = matchlist(line,
|
||||
\ '^\(.*\)||\(.*\)||\(.*\)||\(.*\)||\(.*\)')
|
||||
if !empty(matches) && !empty(matches[1])
|
||||
let s:type_length = max([s:type_length,
|
||||
\ len(matches[2]) + 3])
|
||||
call add(res, {
|
||||
\ 'key': matches[1],
|
||||
\ 'type': matches[2],
|
||||
@@ -305,6 +310,7 @@ endfunction
|
||||
" }}}
|
||||
|
||||
" BibTeX completion {{{
|
||||
let s:type_length=0
|
||||
function! LatexBox_BibComplete(regexp)
|
||||
|
||||
" treat spaces as '.*' if needed
|
||||
@@ -316,9 +322,12 @@ function! LatexBox_BibComplete(regexp)
|
||||
endif
|
||||
|
||||
let res = []
|
||||
let s:type_length = 4
|
||||
for m in LatexBox_BibSearch(regexp)
|
||||
let type = m['type'] == '' ? '[-]' : '[' . m['type'] . '] '
|
||||
let type = printf('%-' . s:type_length . 's', type)
|
||||
let auth = m['author'] == '' ? '' : m['author'][:20] . ' '
|
||||
let auth = substitute(auth, '\~', ' ', 'g')
|
||||
let year = m['year'] == '' ? '' : '(' . m['year'] . ')'
|
||||
let w = { 'word': m['key'],
|
||||
\ 'abbr': type . auth . year,
|
||||
|
||||
@@ -19,29 +19,39 @@ ru! syntax/html.vim
|
||||
unlet b:current_syntax
|
||||
|
||||
|
||||
syn keyword hbsTodo TODO FIXME XXX contained
|
||||
syn region hbsInside start=/{{/ end=/}}/ keepend
|
||||
|
||||
syn match hbsError /}}}\?/
|
||||
syn match hbsInsideError /{{[{#<>=!\/]\?/ containedin=@hbsInside
|
||||
syn keyword hbsTodo TODO FIXME XXX contained
|
||||
|
||||
syn cluster htmlHbsContainer add=htmlHead,htmlTitle,htmlString,htmlH1,htmlH2,htmlH3,htmlH4,htmlH5,htmlH6
|
||||
syn region hbsInside start=/{{/ end=/}}/ keepend transparent containedin=@htmlHbsContainer
|
||||
syn match hbsError /}}}\?/
|
||||
syn match hbsInsideError /{{[{#<>=!\/]\?/ contained containedin=@hbsInside
|
||||
|
||||
syn match hbsHandlebars "{{\|}}" containedin=hbsInside
|
||||
syn match hbsUnescape "{{{\|}}}" containedin=hbsInside
|
||||
syn match hbsOperators "=\|\.\|/" containedin=hbsInside
|
||||
syn match hbsHandlebars "{{\|}}" contained containedin=hbsInside
|
||||
syn match hbsUnescape "{{{\|}}}" contained containedin=hbsInside extend
|
||||
syn match hbsOperators "=\|\.\|/" contained containedin=hbsInside
|
||||
|
||||
syn region hbsSection start="{{[#/]"lc=2 end=/}}/me=e-2 containedin=hbsInside
|
||||
syn region hbsPartial start=/{{[<>]/lc=2 end=/}}/me=e-2 containedin=hbsInside
|
||||
syn region hbsMarkerSet start=/{{=/lc=2 end=/=}}/me=e-2 containedin=hbsInside
|
||||
syn region hbsSection start="{{[#/]"lc=2 end=/}}/me=e-2 contained containedin=hbsInside
|
||||
syn region hbsPartial start=/{{[<>]/lc=2 end=/}}/me=e-2 contained containedin=hbsInside
|
||||
syn region hbsMarkerSet start=/{{=/lc=2 end=/=}}/me=e-2 contained containedin=hbsInside
|
||||
|
||||
syn region hbsComment start=/{{!/rs=s+2 end=/}}/re=e-2 containedin=htmlHead contains=hbsTodo,Todo
|
||||
syn region hbsBlockComment start=/{{!--/rs=s+2 end=/--}}/re=e-2 containedin=htmlHead contains=hbsTodo,Todo
|
||||
syn region hbsQString start=/'/ skip=/\\'/ end=/'/ containedin=hbsInside
|
||||
syn region hbsDQString start=/"/ skip=/\\"/ end=/"/ containedin=hbsInside
|
||||
syn region hbsComment start=/{{!/rs=s+2 end=/}}/re=e-2 contained containedin=hbsInside contains=hbsTodo,Todo
|
||||
syn region hbsBlockComment start=/{{!--/rs=s+2 end=/--}}/re=e-2 contained containedin=hbsInside contains=hbsTodo,Todo extend
|
||||
syn region hbsQString start=/'/ skip=/\\'/ end=/'/ contained containedin=hbsInside
|
||||
syn region hbsDQString start=/"/ skip=/\\"/ end=/"/ contained containedin=hbsInside
|
||||
|
||||
syn match hbsConditionals "\([/#]\(if\|unless\)\|else\)" containedin=hbsInside
|
||||
syn match hbsHelpers "[/#]\(with\|each\)" containedin=hbsInside
|
||||
syn match hbsConditionals "\([/#]\(if\|unless\)\|else\)" contained containedin=hbsInside
|
||||
syn match hbsHelpers "[/#]\(with\|each\)" contained containedin=hbsInside
|
||||
|
||||
syn cluster allHbsItems add=hbsTodo,hbsError,hbsInsideError,hbsInside,hbsHandlebars,
|
||||
\ 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.
|
||||
|
||||
@@ -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 rustStringContinuation display contained /\\\n\s*/
|
||||
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 rustDeriving start="deriving(" end=")" contained contains=rustTrait
|
||||
|
||||
Reference in New Issue
Block a user