Thursday, 15 January 2015

vim - Emacs Evil "repeat" (dot) behavior -



vim - Emacs Evil "repeat" (dot) behavior -

i have next line in .emacs

(define-key evil-normal-state-map "\m-j" (lambda () (interactive) (evil-next-line 5)))

that makes navigation in file easier. instance, m-j go 5 lines below, don't have press j 5 times. same hjkl. problem command pollutes last repeat in evil (the dot), let's replace word in given line, m-j go alter word 5 lines below. if press ., jump 5 lines below, instead of replacing word happen in vim. if utilize of hjkl though, won't pollute last repeat. how can function doesn't pollute last repeat?

edit: noticed doesn't happen \m-j , \m-k, \m-h , \m-l, problem stranger. both defined as:

(define-key evil-normal-state-map "\m-h" '(lambda () (interactive) (evil-backward-char 5)))

(define-key evil-normal-state-map "\m-l" '(lambda () (interactive) (evil-forward-char 5)))

just replace lambda defun say: (defun my-5-lines-down...)and (evil-declare-motion 'my-5-lines-down) in evil (and vim?) motions not count repeatables should trick. alternatively can utilize evil-define-motioninstead of defun if want command on jump list. see documentation defining motion.

vim emacs

No comments:

Post a Comment