summaryrefslogtreecommitdiffstats
path: root/ftplugin/latex-box/common.vim
diff options
context:
space:
mode:
authorAdam Stankiewicz <sheerun@sher.pl>2014-07-29 13:03:49 +0200
committerAdam Stankiewicz <sheerun@sher.pl>2014-07-29 13:03:49 +0200
commit5f1223fbc5285689db812236c9100329740a805b (patch)
tree58bc6f11540011afb25826c96f65fa35f5687291 /ftplugin/latex-box/common.vim
parenta59f644d49ee029df48586a6c3c358858f1e6739 (diff)
downloadvim-polyglot-1.9.2.tar.gz
vim-polyglot-1.9.2.zip
Major updatev1.9.2
Diffstat (limited to 'ftplugin/latex-box/common.vim')
-rw-r--r--ftplugin/latex-box/common.vim38
1 files changed, 32 insertions, 6 deletions
diff --git a/ftplugin/latex-box/common.vim b/ftplugin/latex-box/common.vim
index 72a6ef0f..bf6305cc 100644
--- a/ftplugin/latex-box/common.vim
+++ b/ftplugin/latex-box/common.vim
@@ -25,8 +25,20 @@ setlocal efm+=%E!\ %m
" More info for undefined control sequences
setlocal efm+=%Z<argument>\ %m
+" More info for some errors
+setlocal efm+=%Cl.%l\ %m
+
" Show or ignore warnings
if g:LatexBox_show_warnings
+ " Parse biblatex warnings
+ setlocal efm+=%-C(biblatex)%.%#in\ t%.%#
+ setlocal efm+=%-C(biblatex)%.%#Please\ v%.%#
+ setlocal efm+=%-C(biblatex)%.%#LaTeX\ a%.%#
+ setlocal efm+=%-Z(biblatex)%m
+
+ " Parse hyperref warnings
+ setlocal efm+=%-C(hyperref)%.%#on\ input\ line\ %l.
+
for w in g:LatexBox_ignore_warnings
let warning = escape(substitute(w, '[\,]', '%\\\\&', 'g'), ' ')
exe 'setlocal efm+=%-G%.%#'. warning .'%.%#'
@@ -44,6 +56,7 @@ endif
" Push file to file stack
setlocal efm+=%+P**%f
+setlocal efm+=%+P**\"%f\"
" Ignore unmatched lines
setlocal efm+=%-G%.%#
@@ -114,8 +127,8 @@ function! LatexBox_GetMainTexFile()
endif
" 5. borrow the Vim-Latex-Suite method of finding it
- if Tex_GetMainFileName() != expand('%:p')
- let b:main_tex_file = Tex_GetMainFileName()
+ if LatexBox_GetMainFileName() != expand('%:p')
+ let b:main_tex_file = LatexBox_GetMainFileName()
return b:main_tex_file
endif
@@ -127,6 +140,8 @@ endfunction
function! s:PromptForMainFile()
let saved_dir = getcwd()
execute 'cd ' . fnameescape(expand('%:p:h'))
+
+ " Prompt for file
let l:file = ''
while !filereadable(l:file)
let l:file = input('main LaTeX file: ', '', 'file')
@@ -135,6 +150,16 @@ function! s:PromptForMainFile()
endif
endwhile
let l:file = fnamemodify(l:file, ':p')
+
+ " Make persistent
+ let l:persistent = ''
+ while l:persistent !~ '\v^(y|n)'
+ let l:persistent = input('make choice persistent? (y, n) ')
+ if l:persistent == 'y'
+ call writefile([], l:file . '.latexmain')
+ endif
+ endwhile
+
execute 'cd ' . fnameescape(saved_dir)
return l:file
endfunction
@@ -212,15 +237,16 @@ if !exists('g:LatexBox_viewer')
endif
endif
-function! LatexBox_View()
+function! LatexBox_View(...)
+ let lvargs = join(a:000, ' ')
let outfile = LatexBox_GetOutputFile()
if !filereadable(outfile)
echomsg fnamemodify(outfile, ':.') . ' is not readable'
return
endif
- let cmd = g:LatexBox_viewer . ' ' . shellescape(outfile)
+ let cmd = g:LatexBox_viewer . ' ' . lvargs . ' ' . shellescape(outfile)
if has('win32')
- let cmd = '!start /b' . cmd . ' >nul'
+ let cmd = '!start /b ' . cmd . ' >nul'
else
let cmd = '!' . cmd . ' &>/dev/null &'
endif
@@ -230,7 +256,7 @@ function! LatexBox_View()
endif
endfunction
-command! LatexView call LatexBox_View()
+command! -nargs=* LatexView call LatexBox_View('<args>')
" }}}
" In Comment {{{