Proposed tip Please edit this page to improve it, or add your comments below (do not use the discussion page).
You may not like that Vim automatically jumps to the first error when you compile from within Vim using :make
.
Even though the answer is right there in :help :make, for some reason people ask this question somewhat frequently, and after all you're looking on the Internet to find the answer right now, aren't you?
The correct way to avoid jumping to errors after :make
is simply to add a '!', i.e. execute :make!
instead of :make
.
A couple commands don't let you avoid the jump. The cscope commands don't have an option to avoid the jump, and neither does :cfile
. One possible solution is to simply jump back to where you were. If you use one of these commands, or forget to add the '!' to commands which support it, you can just press CTRL+O in normal mode to jump back to where you were (or use :execute "normal! \<C-O>"
in a script).
As a side note, the :vimgrep command also uses the quickfix list, and does not use '!' to avoid jumping, but you can add the 'j' flag to the search to accomplish the same thing.
If the quickfix list is automatically appearing whenever you save a file, that means you have a plugin which automatically runs :make
followed by :copen
or similar on a save. Check the plugin's documentation to see if there is a way to disable it, or edit the plugin to remove the automatic :copen
, and/or add a '!' to the :make
command as suggested.