Thursday, February 16, 2012

Re: Search Wrap

Hi Jay!

On Do, 16 Feb 2012, Jay Heyl wrote:

> I like having search wrap enabled so I can search the whole file without
> thinking about where I started or the direction of my search.
> Unfortunately, I often find myself searching the entire file several times
> because I'm looking at the lines that match the search criteria and miss
> the end of file warning that appears on the status line when the search
> wraps.
>
> Does anyone know of a way to get an audible alert when the search wraps?
> Something as simple as putting a BELL character in the end of file warning
> would probably satisfy my need.

I think, these 2 mappings should do what you want:

nnoremap <expr> n search(@/, 'nW' . (v:searchforward ? '' : 'b')) ? 'n' : "\<ESC>" . (&ws ? 'n' : '')

nnoremap <expr> N search(@/, 'nW' . (v:searchforward ? 'b' : '')) ? 'N' : "\<ESC>" . (&ws ? 'N' : '')

(each one a single line, in case it wraps in the mail.)

This should work, though, it doesn't ring the bell for me. I think I
have deactivated the bell somewhere globally, if I just remembered
where...

But setting 'visualbell' works and flashes the screen, whenever you
wrap.

regards,
Christian

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