I use vim with VIM-LaTeX. I can use \ll to compile and \lv to view. I've set the following options in my .vimrc file:

let g:tex_flavor='latex'
let g:Tex_DefaultTargetFormat='pdf'

When I type \lv, it opens the (previously generated) PDF in evince, as desired. However, when I quit evince, my vim window (not the buffer itself) is overwritten with some of evince's exit messages. For example, with a window like this:

Hello, world!

pressing \lv and then quitting evince yields this:

Example of weird buffer action

Running :redraw! fixes it, but :redraw doesn't.

How can I prevent this behavior?

I've found a solution but would like to know if there's a better one.


Adding the following to the .vimrc fixes it:

let g:Tex_ViewRule_pdf='evince 2>/dev/null'

This redirects evince's error stream to the "black hole" device file.

  • I get this error even if I open evince from the terminal, which doesn't get fixed by this. What can I do in that case? May 14 '19 at 7:59
  • 1
    @KonradHöffner: It’s not really a problem at a terminal, because you’re in cooked mode, but you can still run evince foo.pdf 2>/dev/null.
    – wchargin
    May 15 '19 at 6:02

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.