2

I am starting to use quickfix to handle my latex compilation process. I found the vim-latex package (https://github.com/vim-latex/vim-latex) but I am only interested in the quickfix part, and I want to use my own Makefile, so I merely copied https://github.com/vim-latex/vim-latex/blob/master/compiler/tex.vim to my ~/.vim/compiler/ and commented out the part that sets makeprg. I also modified

if &errorfile ==# ''  ||  &errorfile ==# 'errors.err'
    execute 'set errorfile=' . fnameescape(Tex_GetMainFileName(':p:r') . '.log')
endif

to

if &errorfile ==# ''  ||  &errorfile ==# 'errors.err'
    execute 'set errorfile=' . fnameescape(expand('%:p:r') . '.log')
endif

I also put

compiler tex

in my ~/.vim/ftplugin/tex.vim

The quickfix otherwise works fine, a sample quickfix list looks like,

(a lot of messages from latex log file)
|125 error| Undefined control sequence. \R
./abstract.tex|| ...
(more messages from latex log file)
|197 warning| ...

where the error is marked with red font and the ./abstract.tex is marked with light green font. If I go to the buffer containing the source file and execute :cn, it jumps to the correct line in the source file with the next error/warning, so I believe errorformat is set correctly. :cn also works correctly in the quickfix list window, However, pressing Enter in the quickfix list window around 125 error or 197 warning does not seem to have any effect. Pressing Enter around ./abstract.tex|| does work though. This is a minor issue that I can live with, but I would still like to know any fix to it.

By the way, :verbose nmap <CR> says "No mapping found" in the quickfix window.

My second and main question is as in the sample quickfix list above, there are errors as well as warnings. I am wondering whether there is a way to jump to the next error ignoring all the warnings, and vice versa. In the terminology of quickfix, is there a way to jump to the next error of a certain type (%t in errorformat)? The simple command :cn navigates through all the errors, regardless of the type.

  • 1
    check getqflist(), check returned data, you might find answer to both your problem. You need custom command if you want to skip warning, another option is to tell your compiler to supress warning. – dedowsdi Apr 5 at 8:31
  • Thank you. Would you mind making it an answer? plugin-vim-latex has options to suppress markup of warnings, I just wanted to know such a function is available in general when I asked this question. – Weijun Zhou Apr 5 at 8:35
  • 1
    It's just an advice, you can post the specific answer yourself after you fix both problems. – dedowsdi Apr 5 at 8:45

Your Answer

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

Browse other questions tagged or ask your own question.