This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-06-26
Channels
- # announcements (6)
- # beginners (328)
- # boot (2)
- # cider (72)
- # clara (6)
- # cljdoc (4)
- # cljsrn (5)
- # clojure (78)
- # clojure-europe (3)
- # clojure-italy (22)
- # clojure-nl (4)
- # clojure-spec (3)
- # clojure-uk (114)
- # clojurescript (22)
- # clojurex (54)
- # copenhagen-clojurians (1)
- # core-async (20)
- # cursive (8)
- # data-science (1)
- # datomic (22)
- # duct (11)
- # emacs (32)
- # events (1)
- # figwheel (2)
- # fulcro (18)
- # graalvm (53)
- # graphql (39)
- # luminus (6)
- # nrepl (6)
- # off-topic (53)
- # om (1)
- # re-frame (8)
- # reagent (19)
- # reitit (3)
- # shadow-cljs (28)
- # spacemacs (10)
- # sql (37)
- # tools-deps (33)
- # vim (9)
- # xtdb (6)
I finally got around to learning how to record an use keyboard macros in Spacemacs, specifically using Evil. Its really simple, q
and a name to record, @
and a name to use.
I'll add this to the book soon... https://github.com/practicalli/spacemacs-gitbook/issues/11
Anyone use a different approach with keyboard macros in Spacemacs?
You can also do @ @
to execute the previous macro again; I do that pretty often.
Thanks, that is really useful. I was wondering if such a thing was possible, as using .
to repeat the macro didnt work
And don't forget prefixing @@
with a number. I often have a macro that processes a line in some way. Then I'll either calculate how many lines remain and do them all in one go or else do a page full at a time (`50@@`).
relative line numbers save from calculating the lines too! 😄 and can do it in smaller, precise blocks
This is exactly how macros in vim work, by the way, so this is another thing that evil-mode
is faithful about.
However, I have noticed that macros are more robust and reliable in vim than emacs. I can't remember what I was doing, but a couple of times I've noticed that something that would work as a macro in vim doesn't work in emacs. It may have had to do with switching buffers. (Sometimes I had a macro in vim that would process a file in some way then switch to the next one.)
One more fun note: you can create macros without q
. All q
does is record keystrokes into a register. If you typed out your keystrokes, including escaping control characters (`C-v` in vim, C-q
in emacs), you can just yank the text to a register with e.g. "ay$
then execute it as a macro with @a
. I do this sometimes to debug a long macro that wasn't quite right. Paste from the register, tweak the command string, then yank back to that register.
this is great, thanks. I will definitely be using keyboard macros more now.