In vim, I frequently used the "." shortcut for repeating the last command. I found this extremely useful especially when working with clojure tools to do things like slurp-ing and barf-ing to refactor code.
In Spacemacs, the clojure layer provides a special state called lisp-state
that allows for things like slurp and barf. See here.
What I'm trying to do is find a key, like .
, that I can bind to some command that would allow me to repeat an action like a slurp
.
By default, in evil-mode
the .
is bound to evil-repeat
. However, doing that creates odd behavior. For example, a common scenario in which I use the repeat is when editing lisp files. Let's say I slurp a text like so using Ctrl + k, s:
() + a b => (+) a b
In vim, I would hit the "." key to continue moving the paren to the right. With the setting above in Emacs (Spacemacs), I got a behavior I did not understand. If I hit .
, the slurp is not repeated. Instead, I see the following at the bottom of the screen:
state: lisp -> normal
I also tried to remap the .
key to the repeat
command instead of evil-repeat
, but I get the same behavior.
It appears that the repeat key somehow first interacts with the lisp-state
, perhaps returning the browser to normal state. So my question is what is the right way to repeat an action like slurp in lisp-state
, and can this method be bound to a key?
evil-mode
then I can see that.
is already bound toevil-repeat
.repeat
), then show how you're binding Evil's (akaevil-repeat
) which is already bound inevil-normal-state-map
, so whatever you're doing is a no-op..
is bound toevil-repeat
, butevil-repeat
is the command that I have to hit twice, and which the first time causes this messagestate: lisp->normal
to appear. I'll try to make the question clearer.global-key-set
. It doesn't seem like the question is about key-binding at all. Instead, it looks like it's a question about how to repeatedly slurp. You might have better luck asking about how to repeat commands or how the slurping package works. BTW, what package provides the slurping functionality? I've seen it before, but it's not a default GNU Emacs function (although it seems to be packaged with Spacemacs).