Trying to write elisp code to select inner WORD as achieved by viW normal mode keystrokes
Hi, I am a happy user of evil-visualstar (https://github.com/bling/evil-visualstar/blob/master/evil-visualstar.el) I frequently use this key sequence: 'viW*' (without the quotes) I'd like to write a short function that achieves this so that I can map it to a single key in evil-normal-state-map, something like (defun guivho-viW-star() "Visual select inner WORD and search for it" (interactive) ;(select-inner-WORD-function-as-would-be-achieved-by-viW) (evil-visualstar/begin-search-forward)) I've looked up what is called by 'v', and it claims to be defined in evil-states-el, but I don't find it there. It claims to be defined as (evil-visual-char &optional MARK POINT TYPE MESSAGE) but I don/t know how to express the 'iW' part in that signature. Please advise, TIA, Guido
Did you ever try something like (define-key evil-normal-state-map (kbd "YOURKEY") "viW*") (i.e., just bind your key to the string "viW*")? Frank
Does this work? (define-key evil-normal-state-map (kbd "`") "viW*") Change the backtick to the key you want to bind to, of course. On 1/27/16, Guido Van Hoecke <[email protected]> wrote:
Hi,
I am a happy user of evil-visualstar (https://github.com/bling/evil-visualstar/blob/master/evil-visualstar.el)
I frequently use this key sequence: 'viW*' (without the quotes)
I'd like to write a short function that achieves this so that I can map it to a single key in evil-normal-state-map, something like
(defun guivho-viW-star() "Visual select inner WORD and search for it" (interactive) ;(select-inner-WORD-function-as-would-be-achieved-by-viW) (evil-visualstar/begin-search-forward))
I've looked up what is called by 'v', and it claims to be defined in evil-states-el, but I don't find it there. It claims to be defined as
(evil-visual-char &optional MARK POINT TYPE MESSAGE)
but I don/t know how to express the 'iW' part in that signature.
Please advise,
TIA,
Guido
Hi Gordon and Frank, Thanks for the suggestion, it does indeed work :) Silly me, I never realized that a key could be set to some other keystrokes rather than an elisp form... Guido On 31 January 2016 at 17:56, Gordon Gustafson <[email protected]> wrote:
Does this work?
(define-key evil-normal-state-map (kbd "`") "viW*")
Change the backtick to the key you want to bind to, of course.
On 1/27/16, Guido Van Hoecke <[email protected]> wrote:
Hi,
I am a happy user of evil-visualstar (https://github.com/bling/evil-visualstar/blob/master/evil-visualstar.el )
I frequently use this key sequence: 'viW*' (without the quotes)
I'd like to write a short function that achieves this so that I can map it to a single key in evil-normal-state-map, something like
(defun guivho-viW-star() "Visual select inner WORD and search for it" (interactive) ;(select-inner-WORD-function-as-would-be-achieved-by-viW) (evil-visualstar/begin-search-forward))
I've looked up what is called by 'v', and it claims to be defined in evil-states-el, but I don't find it there. It claims to be defined as
(evil-visual-char &optional MARK POINT TYPE MESSAGE)
but I don/t know how to express the 'iW' part in that signature.
Please advise,
TIA,
Guido
_______________________________________________ implementations-list mailing list [email protected] https://lists.ourproject.org/cgi-bin/mailman/listinfo/implementations-list
participants (3)
-
Frank Fischer -
Gordon Gustafson -
Guido Van Hoecke