highlight - Emacs style highlighting for incremental search in vim -
in vim, there way enable on-the-fly highlighting all matches when searching?
if enable incsearch , type "/something" highlight first match only. if enable hlsearch , type "/something", nothing happens until press enter (it highlights previous search).
in emacs first match highlighted, , (after slight delay) other matches on screen highlighted in different color, giving instant feedback when scanning matches in piece of code.
doesn't answer question, maybe this wikia post can help?
quote post:
put following code in vimrc, or create file ~/.vim/plugin/autohighlight.vim (unix) or $home/vimfiles/plugin/autohighlight.vim (windows) containing script below. restart vim.
to automatically highlight current word, type
z/
. turn off, typez/
again." highlight instances of word under cursor, when idle. " useful when studying strange source code. " type z/ toggle highlighting on/off. nnoremap z/ :if autohighlighttoggle()<bar>set hls<bar>endif<cr> function! autohighlighttoggle() let @/ = '' if exists('#auto_highlight') au! auto_highlight augroup! auto_highlight setl updatetime=4000 echo 'highlight current word: off' return 0 else augroup auto_highlight au! au cursorhold * let @/ = '\v\<'.escape(expand('<cword>'), '\').'\>' augroup end setl updatetime=500 echo 'highlight current word: on' return 1 endif endfunction
Comments
Post a Comment