On Fri, 1 Oct 2010, Étienne Faure wrote:

On Fri, Oct 1, 2010 at 16:48, Benjamin R. Haskell wrote:

On Fri, 1 Oct 2010, Karthick Gururaj wrote:

On Fri, Oct 1, 2010 at 7:30 PM, Jeff Perry wrote:

When I run my program from within vim

     :./xyz

and the program errors out with a runtime error, e.g.:

    myprog: myprog.cpp:123: assertion 'x==1' failed

vim tries to interpret the the output and jump to the offending line number.

The problem is that in the example above it incorrectly interprets the filename as "myprog: myprog.cpp", so it opens a file with that name, which doesn't exist, and then tries to jump to line 123 in that non-existent file.

My question is:  Where in vim is this behaviour specified and how can I tweak it to do the right thing?

See :help errorformat

Try,
:set efm=%*[^\ ]%f:%l:%m


You also have to get the output of xyz into a file:
./xyz 2>&1 | tee xyz.err

It might be[1] easier to:

:set makeprg=./xyz

(and run via :make)

It handles the redirects you suggest ('2>&1 | tee') via the 'shellpipe' option.

--
Best,
Ben

[1] depends on what kind of program it is -- if it's compiled, you might not want to coöpt the 'make' mechanism.

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Reply via email to