At the moment, using vim I have to first save with :w and then compile using \ll, moreover compilation displays all sort of trash and asks to press enter at the end; what I would like instead is that when I press \ll it automatically saves and displays only something similar to when I digit in my terminal pdflatex file | grep arning: is it possible to achieve this with something like let g:Tex_CompileRule_pdf = 'pdflatex $* | grep arnin in my .vimrc file?


g:Tex_CompileRule_pdf is used as part of the compilation process, vim-latex has some capabilities to repeat compilations until the entire document is compiled (i.e. \ll will trigger a latex bibtex latex latex run if appropriate based on detected changes to the aux etc. files) so that shouldn't be doing more than executing whichever flavour of LaTeX you're using with the appropriate options.

In order to save and compile the file I introduce a new mapping,

map <Leader>t :w<CR><bar><Leader>ll

in my .vim/ftplugin/tex.vim file (which I use such that this mapping will only be enabled for files with filetype tex rather than for all files as you'd get using your .vimrc). From this whenever I use \t vim will first write the file then execute the default vim-latex compile that you get from \ll.

I'm not clear what the aim of grep arning (warning?) is, but as with the case above you should be able to use

map <Leader>t :w<CR><bar><Leader>ll<bar>:grep arning *<CR>

or whatever you would do in vim to achieve the desired effect after the second .

  • thanks! yes, actually i do grep Warning and overfull – jj_p Oct 31 '17 at 21:12
  • actually, with let g:tex_flavor = "latex" and let g:Tex_DefaultTargetFormat='pdf' in my .vimrc i still do not get the output as parsed by grep, and moreover it does not save even with your suggestion. i think i'm misunderstanding something here – jj_p Oct 31 '17 at 21:19
  • just to clarify, the meaning of grep arning is to obtain the same as when i type in the shell pdflatex file.tex | grep Warning, but this is of secondary relevance wrt the save issue – jj_p Oct 31 '17 at 21:23
  • 1
    Ah, try map <Leader>t :w<CR><bar><Leader>ll<bar>:grep warning *<CR> which will use grep from within vim. Vim-LaTeX does open a split containing excerpts from the log with any warnings should they occur which can be somewhat customised (vim-latex.sourceforge.net/documentation/latex-suite/…) – Dai Bowen Oct 31 '17 at 22:01
  • 1
    @jj_p I have no experience of grep (hence didn't twig the need for a wildcard), if you don't want the vim grep, use:!grep rather than :grep, otherwise I can't really help, it sounds like this is now a grep/vim-specific problem. – Dai Bowen Nov 1 '17 at 12:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.