2

I'd like to execute an evil-ex command from another command. Specifically, I'd like to do :'<,'>move'>+1 but when I do, it doesn't quite do the right thing. Instead of moving the text down, it moves it one line from the top of the file.

Here's what I'm using:

(defun evil-visual-move-line-down () (interactive) (evil-ex-call-command (evil-ex-range (evil-ex-line (evil-ex-marker "<") nil) (evil-ex-line (evil-ex-marker ">") nil)) "move" "'>+1")) (define-key evil-visual-state-map (kbd "J") 'evil-visual-move-line-down) 
2
  • Please don't. Evil's authors recommend writing extensions to it in standard Emacs Lisp, not by composing its parts. Commented Mar 6, 2016 at 10:55
  • Thanks for the info, I've made some more progress, but got stuck again. I emailed the mailing list. Commented Mar 6, 2016 at 16:28

1 Answer 1

1

From Frank Fischer himself:

(define-key evil-visual-state-map "J" (concat ":m '>+1" (kbd "RET") "gv=gv")) (define-key evil-visual-state-map "K" (concat ":m '<-2" (kbd "RET") "gv=gv")) 
1
  • If this post solved your problem, could you accept your own answer so we can mark it as done, please? Commented Apr 5, 2016 at 21:57

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.