summaryrefslogtreecommitdiffstats
path: root/ftplugin/latex-box/complete.vim
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 /ftplugin/latex-box/complete.vim
parent085aad28a49395507b4ef1939b2fd75d6db781bf (diff)
downloadvim-polyglot-57cfac7ae384466c3ff2543a9200319dc1d459a0.tar.gz
vim-polyglot-57cfac7ae384466c3ff2543a9200319dc1d459a0.zip
Update latex, csv, handlebars and rust
Diffstat (limited to 'ftplugin/latex-box/complete.vim')
-rw-r--r--ftplugin/latex-box/complete.vim11
1 files changed, 10 insertions, 1 deletions
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,