tags:

views:

130

answers:

3

When executing :make from vim, after make is complete it automatically jumps to a file with errors. Is there a way to avoid this

EDIT

This is usecase i want to achieve I want :make to execute then quicklist to open but the current file which i am working on should not be switched to the one with errors

with default settings after :make execution quicklist opens and the current file also changes

+4  A: 

From the docs:

    7. If [!] is not given the first error is jumped to.

So, just invoke it as :make!.

Jefromi
even with this option it jumped to the file.
Yogesh Arora
I've just tested on vim 7.1 using `:make!` did not jump to the first error, I was still on the same spot in the file where I open it - error was in different file
stefanB
A: 

It might not be the cleanest solution, but setting the errorformat to an empty string should do the trick, ie.

:set errorformat=""

That should keep it from matching the compiler error strings.

Andreas
+1  A: 

You can run :make! | copen, which should place your cursor in the quickfix list instead of changing the current buffer. You can make this even easier by putting command Mymake make! | copen in your .vimrc, so you only have to run :Mymake to do this.

Note that when selecting errors from the quickfix list, they will scroll a buffer with the file already open rather than change the current window if possible, and you can open the files in new windows with <C-w> Enter.

m42a
I'm surprised this was accepted - while of course `copen` by definition activates the list of errors, if `:make!` changed the open file, it'll still have changed.
Jefromi