There are a couple of handy shortcuts in vim that allow you to highlight text and then hit '/' or '?' to search forwards or backwards for the next occurrence of the selected text. The mappings are: vnoremap / y/<C-R>"<CR> vnoremap ? y?<C-R>"<CR> Is there any way to replicate this functionality in evil?
You may want to take a look at https://github.com/bling/evil-visualstar :) On Oct 14, 2014 3:33 PM, "David Nebauer" <[email protected]> wrote:
There are a couple of handy shortcuts in vim that allow you to highlight text and then hit '/' or '?' to search forwards or backwards for the next occurrence of the selected text. The mappings are:
vnoremap / y/<C-R>"<CR>
vnoremap ? y?<C-R>"<CR>
Is there any way to replicate this functionality in evil?
_______________________________________________ implementations-list mailing list [email protected] https://lists.ourproject.org/cgi-bin/mailman/listinfo/implementations-list
Am 14.10.2014 um 15:30 schrieb David Nebauer:
There are a couple of handy shortcuts in vim that allow you to highlight text and then hit '/' or '?' to search forwards or backwards for the next occurrence of the selected text. The mappings are:
vnoremap / y/<C-R>"<CR>
vnoremap ? y?<C-R>"<CR>
Is there any way to replicate this functionality in evil?
Actually it is almost possible out of the box. First, you need to use Evil's own search module (M-x customize-variable RET evil-search-module RET). Then add the following binding: (define-key evil-ex-search-keymap "\C-r" 'evil-paste-from-register) The list of useful bindings in search mode is currently quite sparse and this one is missing but should just work. Then you can do something quite similar to Vim: (define-key evil-visual-state-map "/" "y/\C-r\"\C-m") Note that Evil (and Emacs) do not support non-recursive remappings. But in this case it's no problem because {lhs} goes to visual state and the call `/` in {rhs} is executed in normal state. Best regards, Frank
participants (3)
-
David Nebauer -
Frank Fischer -
Johann Klähn