1

I'm using spacemacs with vim-bindings, but I only mention it so you don't scratch your head too long at the keystrokes of the macro. A regular emacs solution will work just the same.

I've read through the naming and saving section of the manual. This is nice but it's a lot of steps and the output is verbose and unpleasing to the eye:

(fset 'insert-code-block
   (kmacro-lambda-form [?o ?\{ return ?\} escape ?O escape] 0 "%d"))

I've also read this post with similar naming.

I would like to use something like kbd syntax:

(kbd "o { RET } <escape> O")

For reference, this was the keychord binding I used with regular emacs:

(key-chord-define-global "xb" (kbd "RET { RET RET } C-p TAB"))

1 Answer 1

1

Turns out you can just use the kbd function:

(fset 'insert-code-block
   (kbd "o { RET } <escape> O"))
2
  • FYI - you can accept your own answer (you may need to wait some period first; dunno).
    – Drew
    Commented Feb 28, 2022 at 2:33
  • Yes, was in the waiting period. Thank you for the reminder though!
    – mcp
    Commented Mar 3, 2022 at 2:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.