>---start---
>" Highlight current search hit so can easily see it if many hits.
>highlight SearchCurrent guifg=black guibg=DarkOrange
>augroup highlight_current
> autocmd!
> autocmd CursorMoved * silent call <SID>HighlightCurrent()
>augroup END
>
>function! s:HighlightCurrent()
> if exists('b:searchmatch')
> call matchdelete(b:searchmatch)
> unlet b:searchmatch
> endif
> let beg = searchpos(@/, 'cnW', line('.'), 100)
> if beg != [0, 0]
> let end = searchpos(@/, 'cenW', line('.'), 100)
> if end != [0, 0]
> let b:searchmatch = matchadd('SearchCurrent', printf(
>'\%%%dl\%%%dc\_.*\%%%dl\%%%dc.', beg[0], beg[1], end[0], end[1]))
> endif
> endif
>endfunction
>---end---
I'm not sure what this is supposed to look like. I put it in my .vimrc (after unwrapping the line) and opened another file, set hls and did a search. All search results looked exactly as they do normally, even after specifically :so'ing my .vimrc again...
--
.
--
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