dj
in vim deletes the current line as well as the next. It's a bit idiosyncratic (in that it doesn't really make sense as a motion) but I've come to rely on it.
In evil, however, dj
deletes only the current line. How can I remap it so that it has vim's behaviour?
I've tried a few methods and all don't work:
(defun delete-two-lines ()
(interactive)
(kill-whole-line)
(kill-whole-line))
- using
key-chord.el
:(key-chord-define evil-normal-state-map "dj" 'delete-two-lines)
- trying to remap the
j
motion in evil to jump two lines ((evil-line-move 2)
). This works but affects every use ofj
. dd
is a linewise shortcut; it's not special-cased, so I can't hook into it (why is evil so elegant...)(define-key evil-mode-normal-map (kbd "dj") 'delete-two-lines)
:d
isn't a prefix key, and this seems like it would interfere with evil'sd
mapping anyway
I'm at my wit's end. Help would be appreciated.
dj
deletes two lines here. – wasamasa Aug 5 '15 at 16:10j
is bound to the defaultevil-next-line
? – Dan♦ Aug 5 '15 at 16:11evil-next-visual-line
. I'm trying to replicate the more commonly-used parts of my vim setup basically. – user1953221 Aug 6 '15 at 0:48