Wednesday, January 30, 2013

How to make search with 'wrapscan' more convenient?

Hello,

I have 'set wrapscan' in my .vimrc. During search Vim displays 'search
hit bottom, continuing at top' message. It is pretty useless with
'wrapscan' because in most cases what I'm really interested in, is
notification whether I have reached position from which my search
started.

Example: I have file with 1000 lines of text. I start '/foo' at line
400. I want to search whole file i.e. lines 400 - 1000 and 1 - 400.
Then I want Vim to notify me "search hit starting position". Is there
a way to make Vim to behave like this?

Without such notification I end up racking my brain: "Hmm, have I
already reached line 400?" every 'n' pressing after 'search hit
bottom, continuing at top' message. I often miss starting position and
after couple of redundant 'n' find myself doing search through text
that has been already searched.

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?

--
--
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:

Post a Comment