Vim Tips Wiki
(Created page with "One of my largest annoyances with Vim is the great Quickfix, in particular the auto-jump. The reasons for this do not matter, but I wanted to disable it really bad. It took me se...")
 
(how to avoid jumping with make commands, and better solution than removing the quickfix list in general)
Line 16: Line 16:
   
 
I use Vim to edit TeX-files, and want to know about boxing errors (underfull, overfull) so that I can fix those. In very few cases, however, I can not fix it, because I am quoting an exercise from a book for my homework. But, everytime I type ':make', it jumps to the boxing error, and I lost where I am.
 
I use Vim to edit TeX-files, and want to know about boxing errors (underfull, overfull) so that I can fix those. In very few cases, however, I can not fix it, because I am quoting an exercise from a book for my homework. But, everytime I type ':make', it jumps to the boxing error, and I lost where I am.
  +
  +
==Comments==
  +
I fail to see any reason why one would use :make at all, if they weren't interested in using quickfix. Can you enlighten me? Without the quickfix list, you get no feedback in Vim about the :make results.
  +
  +
For your immediate problem, just add a '!'. I.e., instead of <tt>:make</tt>, type <tt>:make!</tt>. This suppresses the automatic jump to the first error.
  +
  +
For vimgrep, etc., there are other ways to avoid the jump.
  +
  +
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 <tt>:cfile</tt>. However, a much better solution to deleting the quickfix list, would be to simply jump back to where you were. I think there's an ex command to do it, but failing that, just an :execute "normal! \<C-O>" should do the trick.
  +
  +
--[[User:Fritzophrenic|Fritzophrenic]] 17:54, November 17, 2011 (UTC)

Revision as of 17:54, 17 November 2011

One of my largest annoyances with Vim is the great Quickfix, in particular the auto-jump. The reasons for this do not matter, but I wanted to disable it really bad. It took me several months to figure out how to do it, and the end-result still feels like a hack.

The code for this

Put the following in your .vimrc

autocmd QuickFixCmpPost * call setqflist([])

What this does is quite inhumane: it deletes the quickfix-list. I am still looking for a way to disable the `jump' without deleting the list.

Use case

Obviously, quickfix is a sacred thing, and should never be disabled. To figure out why I would still want to, read the following.

I use Vim to edit TeX-files, and want to know about boxing errors (underfull, overfull) so that I can fix those. In very few cases, however, I can not fix it, because I am quoting an exercise from a book for my homework. But, everytime I type ':make', it jumps to the boxing error, and I lost where I am.

Comments

I fail to see any reason why one would use :make at all, if they weren't interested in using quickfix. Can you enlighten me? Without the quickfix list, you get no feedback in Vim about the :make results.

For your immediate problem, just add a '!'. I.e., instead of :make, type :make!. This suppresses the automatic jump to the first error.

For vimgrep, etc., there are other ways to avoid the jump.

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. However, a much better solution to deleting the quickfix list, would be to simply jump back to where you were. I think there's an ex command to do it, but failing that, just an :execute "normal! \<C-O>" should do the trick.

--Fritzophrenic 17:54, November 17, 2011 (UTC)