This list of call-interactively
actually represents a very simple Vim macro: vk=o
(define-key evil-normal-state-map (kbd "SPC dg")
(lambda ()
(interactive)
(call-interactively 'evil-visual-char)
(call-interactively 'evil-previous-line)
(call-interactively 'indent-region)
(call-interactively 'evil-open-below)))
Question
Is there a simple way to execute vim commands inside elisp?
Notes
I have found that you can bind vim macros to keyboard shortcuts using global-set-key
.
Something like this: (global-set-key (kbd "C-c C-l") "vk=o")
But trying to see how global-set-key was doing it, it lead me to compiled C code from define-key
which didn't help much.
I am looking to write something perhaps alike:
(define-key evil-normal-state-map (kbd "SPC dg")
(lambda ()
(interactive)
;; some code
(eval-vim-macro "vk=o")))
Thanks for the help!