summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdam Stankiewicz <sheerun@sher.pl>2013-10-17 15:54:18 +0200
committerAdam Stankiewicz <sheerun@sher.pl>2013-10-17 15:54:18 +0200
commit57cfac7ae384466c3ff2543a9200319dc1d459a0 (patch)
treed9c89bda58e53cf4c23442df3cd15309ee621aa6
parent085aad28a49395507b4ef1939b2fd75d6db781bf (diff)
downloadvim-polyglot-57cfac7ae384466c3ff2543a9200319dc1d459a0.tar.gz
vim-polyglot-57cfac7ae384466c3ff2543a9200319dc1d459a0.zip
Update latex, csv, handlebars and rust
-rw-r--r--after/syntax/tex.vim6
-rw-r--r--ftplugin/csv.vim4
-rw-r--r--ftplugin/latex-box/complete.vim11
-rw-r--r--syntax/handlebars.vim44
-rw-r--r--syntax/rust.vim1
5 files changed, 44 insertions, 22 deletions
diff --git a/after/syntax/tex.vim b/after/syntax/tex.vim
index 32af7253..b11207dc 100644
--- a/after/syntax/tex.vim
+++ b/after/syntax/tex.vim
@@ -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
diff --git a/ftplugin/csv.vim b/ftplugin/csv.vim
index ddf01916..992b86a7 100644
--- a/ftplugin/csv.vim
+++ b/ftplugin/csv.vim
@@ -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
diff --git a/ftplugin/latex-box/complete.vim b/ftplugin/latex-box/complete.vim
index 61ddd70c..2414be3c 100644
--- a/ftplugin/latex-box/complete.vim
+++ b/ftplugin/latex-box/complete.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,
diff --git a/syntax/handlebars.vim b/syntax/handlebars.vim
index fd7618b5..706a4501 100644
--- a/syntax/handlebars.vim
+++ b/syntax/handlebars.vim
@@ -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.
diff --git a/syntax/rust.vim b/syntax/rust.vim
index c465f076..7d51c3b8 100644
--- a/syntax/rust.vim
+++ b/syntax/rust.vim
@@ -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