> function ToggleHLSearch()
>   if &hls
>     set nohls
>   else
>     set hls
>   endif
> endfunction
> nmap <silent> <C-n> :silent call ToggleHLSearch()<CR>

As an aside, this can be simplified using the "inv"erse notation 
for any boolean setting, written as either

   :set invhls

or

   :set hls!

I use this regularly with 'list' to toggle between set/unset with 
":set list!"  which is documented in the help at the bottom of the

   :help E518

section.


> But if I have consecutive matches, it is still not easy to see how
> many matches there are. In particular, '\t' can occupy different
> length of spaces, depending the context. Therefore, I would like the
> highlight be nonconsecutive (for example, one pixel with between two
> matches is not highlighted).

To the best of my knowledge, I don't believe you can do this, 
especially in non-GUI vim -- character-cells don't have spacing, 
and if they did, you'd get gaps between *all* the cells in the 
highlighted range.  The best I could come up with was to use the 
\zs or \ze token in the regexp to tell vim when to start/stop 
highlighting to omit the delimiting space/tab character from 
being highlighted.

-tim





--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply via email to