Thursday, August 30, 2012

vim latex setup (most updated)

tried so many times and searched all over google but no one works,
finally find out by myself
so let me put it here:

in sumtrapdf, settings, option, inverse search put:
"C:\Program Files\Vim\vim73\gvim.exe" --remote-silent +%l "%f"

in latex-suite, search in ftplugin/latex-suite/compiler.vim and modify
as follows:

original:
if (has('win32') && (viewer =~? "^ *yap\( \|$\)"))
let execString = 'silent! !start '. viewer.' -s
'.line('.').expand('%').' '.mainfnameRoot

New:
if (has('win32') && (viewer =~? "^ *yap\( \|$\)" || viewer =~? "^sumatrapdf"))
if viewer =~? "^sumatrapdf"
let relativeFile=substitute(expand("%:p"),
Tex_GetMainFileName(':p:h').'/', '','')
let execString = 'silent! !start SumatraPDF
-reuse-instance "'.mainfnameFull.'.'.s:target.'" -forward-search
"'.relativeFile.'" '. line('.')
else
let execString = 'silent! !start '. viewer.' -s
'.line('.').expand('%').' '.mainfnameRoot
endif

in vimrc put:
let g:Tex_DefaultTargetFormat = 'pdf'
let g:Tex_CompileRule_pdf='xelatex --synctex=-1 -src-specials
-interaction=nonstopmode $*'
let g:Tex_ViewRule_pdf='SumatraPDF'
let g:Tex_MultipleCompileFormats='pdf'

Okay, thats it, no bother, forward(\ls) and backword searching (double click)

No comments:

Post a Comment