Friday, May 28, 2010

Re: How to avoid returning to the beginning when I search for one string

On 05/27/2010 10:29 PM, John Beckett wrote:
> robert song wrote:
>> I search for one string in vim with "n", but if all strings
>> is searched, it will return to the beginning of the file.
>
> See 'nowrapscan' at:
> http://vim.wikia.com/wiki/Searching
>
> However, the better answer is to get used to it because it is
> very useful in practice! What you need to do is have a prominent
> message when wrap around occurs so you don't wonder when it has
> happened. For example:
>
> :hi WarningMsg ctermfg=15 ctermbg=12 guifg=White guibg=Red gui=NONE

Even with a prominent warning, it can still be easy to miss in
some cases -- I usually fly with the default 'wrapscan', but when
searching long CSV/tab-delim files, I am visually focused on the
hits, not elsewhere on the screen (where the msg is), often
hitting "n" dozens if not hundreds of times. This "road
hypnotism" leads me to temporarily set 'nowrapscan' and search
from the top -- it's much easier to see when you've hit the
bottom if nothing changes visually even after multiple hits of
"n". Not something I use often, but about twice a month, I'm
glad to have the option to change the behavior.

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

Post a Comment