-
Notifications
You must be signed in to change notification settings - Fork 4.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Let me use common escape sequences of the movement keys. #2292
Comments
I'm guessing you've tried (setq-default evil-escape-key-sequence "kj") as well. I've tried to use movement keys and had issues before (it was me on the chat for the information of others). AFAIK they can't be used without side effects, if there's any more information though that would be good to hear. |
A quick google gave me this promising blog post: keychord |
@aeschylus just a note - if you use Seems evil can't process things like vim, no idea why what etc... hopefully someone else chimes in :) |
As @kritzcreek said, Keychord looks a lot like the solution. |
@felipe-barros heard a few people say it's the solution, yet to hear someone say 'yeah I use this and it makes everything as expected' |
evil-escape is built into spacemacs, no need to reinvent the wheel with keychord. It even escapes from "deeper" inside modes, like iedit-insert mode or whatever else. |
Yes, the default "fd" key sequence has a timeout associated with it. I am able to type "f", and if I wait more than about 200ms it will in fact insert the letter "f". Not so with (define-key evil-insert-state-map "kj" 'evil-force-normal-state). |
How would I use |
Put this in your init func in dotspacemacs (before evil-escape loads): |
Evil escape key apparently doesn't work with movement keys. Actually "ij" did not work for me either. This was in my dotspacemacs/config layer. Is there a different place I should put it? |
I'm trying to set |
Yes, it does not work, regardless of where it is placed. |
fwiw, adding |
I have done what @nosami recommended @aeschylus , but it only worked after a restart. |
yeah the sequence generally works but it will create a lag or something which is really annoying and basically renders it unusable... On my system the sequence |
Yes, it interferes with other modes. I finally got "kj" working for general editing, but now in the evil file explorer (if you type |
thought I'd add this here as It's relevant (i think?) I have mapped esc in my init section of .spacemacs as follows :
Now if I want to move 8 lines up i can't use I'm not sure if anyone else has this issue |
Right this is really bugging me :P I've just tried the @felipe-barros when you mapped using @nosami when you say that it worked fine - did you have any lag / restrictions on what you could do? |
I can confirm that commands like |
@aeschylus cheers, of all the things not to be implemented properly in Evil! I'm not sure if this is an emacs or evil issue or what though |
NoteThis has been fixed now and I'm currently using evil-escape rather than key chord OKOKOKOK try this please all : in So your additional packages section should look like this (maybe with others as well, I don't know your ;; additional layers for spacemacs
dotspacemacs-additional-packages '(
key-chord
) Then in the ;; ---------------------------------------------------------------------------
;; -------------------- REMAPPING THE ESC KEY WITH KEYCHORD ------------------
(require 'key-chord)
(key-chord-mode 1)
(key-chord-define evil-insert-state-map "jk" 'evil-normal-state)
;; --------------------------------------------------------------------------- After restarting (or maybe Hope it works for you guys @syl20bnr would be great to add this to the docs if it's a robust solution? I've only just set it up, so perhaps there are problems I haven't yet seen... just to note; I'm compiling others help here, this isn't really my work 🎱 |
@geo7 followed your instructions and it worked fine for me. Escaping, no lag and have yet to find any issues. |
Also worked for me, thanks @geo7 ! Was driving me nuts as well. |
I've found an apparent issue, where if I have defined |
That's the intended behaviour of |
@geo7 You're a hero. Hopefully this ends up in the readme, I'd probably have stopped using spacemacs if I couldn't do this. Not being able to escape normally is such a big piece of friction for such an otherwise nice experience. |
evil-escape was using key-chord at some point, unfortunately I could reliably CRASH emacs with it when configured to use For the lag thing, I'm surprised about the result, evil-escape should be less laggy, essentially in insert-state, in the other states it should be similar to key-chord. Anyway I have a version 3 planned for evil-escape now I have better knowledge about how key maps work :-) |
@syl20bnr the
I'm using it as
it's in
and is in elpa
it's not in the variable is anyone else who has recently updated having problems with key-chord? |
I will fixed as soon as I can, sorry for the inconvenient. |
@geo7 should be OK now. |
@syl20bnr still not working here :/ edit 2now it's broke ffs, going to bed editOK what I did to get it working was ; Comment out the lines that used key-chord, for me they were (require 'key-chord)
(key-chord-mode 1)
(key-chord-define evil-insert-state-map "jk" 'evil-normal-state)
Then reload config with |
I don't know what's going on with your config, I really fixed the issue and it works flawlessly here, I even retried it 3 times, no issue. What is you error ? |
As the problem have been solved upstream and nobody reported this issue the last 3 months, I'm closing it. Feel free open a new issue in case of troubles |
Hi guys, I followed the steps from @geo7 but for some reason the keybindings are not taken by spacemacs...that means, when I press jk in insert mode it doesn't change to normal mode, BUT the mode is running and if I evaluate this expresio M-: (key-chord-define evil-insert-state-map "jk" 'evil-normal-state) works, what could be the reason?..thanks!!! |
Hello. I am trying to get spacemacs to return to "normal mode" (in vim terms) when pressing "kj" in quick succession while in "insert mode". This is a very common vim configuration and I've become accustomed to it. I have tried an earlier suggestion to add "(define-key evil-insert-state-map "kj" 'evil-force-normal-state)", however, this obviously prevents me from typing the letter "k" (or anything after it) at all. Not the intended behaviour.
How can I cause the mode shift only if the keys are pressed in quick succession?
"jf" is another common one.
I have been told on the gitter channel that it is not possible to do with the movement keys.
The text was updated successfully, but these errors were encountered: