On 18/01/10 03:12, Wu, Yue wrote:
Hi, list!

After :vimgrep /pattern/j %, how to make the cursor in quickfix window
be located on the most closing line according to the location of the
buffer that performs the vimgrep?


I'm not sure what you mean by "the buffer which performs the vimgrep".

On my system, opening the quickfix window shows the cursor on the first match (which is the "current" match at that moment), and after any number of :cnext (each of which shows the next match in context), making the quickfix window active (e.g. by clicking its titlebar, or by 99^Ww) shows the cursor on the line corresponding to the current match. Of course, if you make the quickfix window active by clicking somewhere in the middle of it, the cursor will follow your click.

Vimgrep is particularly useful when searching several files for a single regexp. If you want to search only the current file, use / (or ? to search backward) instead of :vimgrep and you'll find the match closest to the previous cursor position. Then,

        instead of              use

        :cnext                  n
        :cprev                  N
        :cfirst                 ggn
        :clast                  GN

See
        :help /
        :help ?


Best regards,
Tony.
--
Two percent of zero is almost nothing.
-- 
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php

Reply via email to