Re: [Vim-latex-devel] function to switch settings
Brought to you by:
srinathava,
tmaas
From: Francesco M. <fra...@gm...> - 2014-02-26 10:24:27
|
Hi Andreas, This might work: Put your default settings (e.g. English) in your .vimrc (or ftplugin/tex) file. In the directory where you want you use the other language (e.g. German) create a main.tex.latexmain file [1] (I'm assuming that the main latex file is main.tex). Then put in main.tex.latexmain: set spell spelllang=de_20 let g:Tex_DefaultTargetFormat = 'pdf' let g:Tex_BibtexFlavor = 'biber' This file is loaded after all the .vimrc and .vim/* files. I've used successfully this trick to compile with pdflatex specific projects, while keeping standard latex as default. Cheers, Fra ref: [1] http://vim-latex.sourceforge.net/documentation/latex-suite/latex-project.html ps: you might think about changing the spelllang only in the current buffer, in particular if you open different filetypes in the same session 2014-02-26 11:09 GMT+01:00 Andreas Groh <and...@tu...>: > Hi @ all, > > I am using vim latex suite for a while an I am quite happy with how it > is working. I often have to switch between tex-projects in German (using > pdflatex with biber) and project in English (using latex with bibtex). > Hence, up to now I have to change the settings in my .vimrc before I > start working on another project. These are my settings: > > "vim-latex plugin settings > set grepprg=grep\ -nH\ $* > let g:tex_flavor = 'latex' > let g:Tex_BibtexFlavor = 'biber' " use biber instead of bibtex > "let g:Tex_BibtexFlavor = 'bibtex' " using bibtex > let g:Tex_UseMakefile = 0 > let g:Tex_ShowErrorContext = 0 > let g:Tex_AutoFolding = 0 > > let g:Tex_CompileRule_dvi = 'latex --interaction=nonstopmode $*' > let g:Tex_CompileRule_ps = 'dvips -o $*.ps $*.dvi' > let g:Tex_CompileRule_pdf = 'pdflatex --interaction=nonstopmode $*' > > let g:Tex_FormatDependency_ps = 'dvi,ps' > let g:Tex_FormatDependency_pdf = 'pdf' > > let g:Tex_MultipleCompileFormats = 'dvi,ps,pdf' > > let g:Tex_DefaultTargetFormat = 'pdf' > "let g:Tex_DefaultTargetFormat = 'ps' > > So before switching from a German to an English project a toggle the > comments for the Tex_DefaultTargetFormat and the Tex_BibtexFlavor (and > the spell checking options). Since this is quite inconvenient I thought > about defining two function which do the job. I added > > :function German() > : :set spell spelllang=de_20 > : :let g:Tex_DefaultTargetFormat = 'pdf' > : :let g:Tex_BibtexFlavor = 'biber' > :endfunction > autocmd FileType tex :command! German :cal German() > > :function English() > : :set spell spelllang=en_gb > : :let g:Tex_DefaultTargetFormat = 'ps' > : :let g:Tex_BibtexFlavor = 'bibtex' > :endfunction > autocmd FileType tex :command! English :cal English() > > to my .vimrc. When I am calling the function English the spell checking > and the bibliography settings are changed correctly. Even the default > format is changed (checked by calling :TTarget) but it is not working as > expected. After calling \ll a pdf file is still build, instead of a ps > file. Sometimes (until now I could find out under which circumstance) a > dvi is build, but not a ps like it should. > > Any ideas what is wrong with my function definition? What do I have to > do in order to correctly change the default target from a function. Any > hint is appreciated. > > Thanks and best regards. > > Andreas > > > > -- > > > ------------------------------------------------------------------------------ > Flow-based real-time traffic analytics software. Cisco certified tool. > Monitor traffic, SLAs, QoS, Medianet, WAAS etc. with NetFlow Analyzer > Customize your own dashboards, set traffic alerts and generate reports. > Network behavioral analysis & security monitoring. All-in-one tool. > > http://pubads.g.doubleclick.net/gampad/clk?id=126839071&iu=/4140/ostg.clktrk > _______________________________________________ > Vim-latex-devel mailing list > Vim...@li... > https://lists.sourceforge.net/lists/listinfo/vim-latex-devel > |