Loading ...
Sorry, an error occurred while loading the content.
 

Re: jumping to errors in non-existent files

Expand Messages
  • jeffsp
    ... Thanks for all the helpful comments. Actually, I had simplified the problem: I am running :make and my Makefile calls ./xyz, so the redirection stuff is
    Message 1 of 6 , Oct 7, 2010
      On Oct 1, 4:24 pm, "Benjamin R. Haskell" <v...@...> wrote:
      > 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.

      Thanks for all the helpful comments. Actually, I had simplified the
      problem: I am running :make and my Makefile calls ./xyz, so the
      redirection stuff is taken care of.

      My solution was to use Karthick Gururaj's suggestion, slightly
      modified:

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

      This, of course, won't work if you put spaces in your filenames.

      --
      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
    Your message has been successfully submitted and would be delivered to recipients shortly.