Wednesday, January 30, 2013

Re: How to make search with 'wrapscan' more convenient?

On Wed, 30 Jan 2013 03:21:11 -0800 (PST) Wiktor Ruben
<smieciarski@gmail.com> wrote:
> My current workflow is to set 'nowrapscan', then mark my current
> position with 'mm', then 'gg' and doing 'n' until Vim displays
> 'search hit bottom, without match for foo'. Then I do '`m' to get
> back where I were before search. How can I improve it?

While I've experienced the same want for a "wrapscan from where my
search started" sort of option, and I don't have a good solution, in
such cases I sometimes use either

:g/pattern

or

:g/pattern/#

to either just print the matches, or number them (which then usually
leads to a jump to the line in question with something like 314G).

You can modify the command to print a range of lines if needed:

:g/pattern/-5;+5#

or

:g/pattern/?{?,/}/#

to give some context.

So, while not a perfect answer, it works for most of my use cases.

-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

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

No comments: