Wednesday, October 6, 2010

Re: saving results of searches

On 10/06/10 07:58, Jürgen Krämer wrote:
>> :%g/^function
>>
>> How does one save these results somewhere? Code is slowly growing and
>> I an tempted to write these results down ;-) !!
>
> One possible way:
>
> :g/^function/.w!>> my-functions.lst

Another way would be to learn to use the quickfix window:

:vimgrep /^function/ %

(the "%" limits it to the current file, but you can use a
filespec instead)

You can then use

:cn
:cN

to navigate back/forwards in the list of matches or use

:copen

to open the quickfix window where you can navigate around and
press <enter> on the one you want. Alternatively, you can use

:lvimgrep /^function/ %
:lopen
:lne
:lN

(though I can't readily explain the benefits/drawbacks of using
the location-list instead of the quickfix list...I usually just
use the QF list).

-tim


--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

No comments: