> nnoremap <silent> * :call histadd("search",
> expand("<cword>")) <bar> let @/='\<'.expand("<cword>").'\>'
> <bar> set hlsearch<CR>
Hmmm ... now I'm confused about <expr>.
The help example makes sense:
:inoremap <expr> . InsertDot()
But is <expr> ever needed with nnoremap?
I'm wondering because in this tip:
http://vim.wikia.com/wiki/Highlight_all_search_pattern_matches
we have this method to highlight matches without moving:
:nnoremap <F8> :let @/='\<<C-R>=expand("<cword>")<CR>\>'<CR>:set hls<CR>
However, it has just been demonstrated that the <C-R>= stuff
is superfluous (I had thought it was necessary if not using
<expr>).
Here is Tinou's mapping tweaked for a little simplification:
" Highlight current word without moving cursor; update history.
:nnoremap <silent> <F8> :let @/='\<'.expand("<cword>").'\>'<Bar>set hls<Bar>call histadd("search",@/)<CR>
I guess I'll put the above in the tip.
John
--
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
To unsubscribe from this group, send email to vim_use+unsubscribegooglegroups.com or reply to this email with the words "REMOVE ME" as the subject.
No comments:
Post a Comment