Wednesday, December 14, 2016

Re: How to prevent asterisk key from advancing to next match when pressed

On 2016-12-14 04:34, Slartibartfast wrote:
> > :nnoremap * :let @/='\<lt>'.expand('<lt>cword>').'\>'<cr>
>
> Wow, what on earth does that mean?
>
> I tried it all the same and yes it does indeed work in gVim but I
> have no idea why.

It remaps the "*" key to run the ex command that follows.

let @/= " assign to the search register
'\<lt>' " a literal \<
. " followed by
expand(...) " the current word under the cursor
'<lt>cword>' " (need to escape the opening < sign)
. " followed by
'\>' " a literal \>
<cr> " actually execute the assignment

> I also tried it in Notepad++ and Android Studio (with their
> respective Vim plugins) and unfortunately it doesn't for either of
> them.

Can't speak to the vim-nature of non-vim. Sorry ;-)

-tim



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

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments: