You may not like that Vim automatically jumps to the first error when you compile from within Vim using
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
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. You could use a QuickFixCmdPost autocmd to delete the quickfix list after creating it, but then you will not be able to view any of the errors, in which case the command you just ran serves no purpose. Thus, a much better solution to deleting the quickfix list, would be 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.