You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Apr 6, 2018. It is now read-only.
Repository navigation
This repository was archived by the owner on Apr 6, 2018. It is now read-only.
I always remap "jj" to escape and it works really well. Super easy to type and I don't remember ever having to type a literal "jj". Not the same as chords like Arpeggio enables, but I find it very useful.
@drbraden How do you type a normal 'j' in insert mode?
Using the keymapping you have suggested, if i type jump I get ump, and of course a 'jj' escapes to command mode.
I prefer a 'kj' mapping which means I can use a 'kk' for a single 'k' in Atom, but this will get old very quickly.
So how can we avoid throwing away the first letter of the command?
Is this likely to be a small task or delving into Atom internals?
Oh, oops, you're right. I guess I just haven't had to type a j in insert mode since I made the change. It works fine in vim and sublime.
It looks like there is an "operator-pending" mode that might be used to get this functionality without discarding the first key when subsequent keys don't match a mapping. It's in the master branch, but it's not in the current release, yet.
In master, they use operator-pending mode to implement "d i w" while in command mode, so I played around a bit trying to do something similar, but so far I haven't been able to get it to work.
I've created atom/atom-keymap#16 to track the integration of textinput events with multi-keystroke bindings. Fixing that still won't allow for multi-key chords, but at least provides better support for the typical j k escape bindings.
I've also created atom/atom-keymap#17 to track support for chords, which is more sophisticated. In time, this is all reasonable, but I personally won't be able to get to it until our plans for the editor renderer are more stable.
Here is a currently working method (as of v1.0.0) of exiting insert mode with "jj" (or the more common "jk" with a minor edit to the keymap.cson change):
@lambdaburrito Glad to hear it! I've spent way too much time chasing down a solution for this, or finding a new one after a breaking upgrade, so I was hoping I could save others the time 😄
Thanks @drbraden! Here is a one-line modification of your code snippet, using editor.buffer.undo() instead of editor.backspace() to preserve selections:
Activity
drbraden commentedon May 8, 2014
I always remap "jj" to escape and it works really well. Super easy to type and I don't remember ever having to type a literal "jj". Not the same as chords like Arpeggio enables, but I find it very useful.
This is how I did it in Atom's keymap file:
I only enabled it for insert mode so it won't interfere with "j" as a movement key.
darkseas commentedon May 9, 2014
@drbraden How do you type a normal 'j' in insert mode?
Using the keymapping you have suggested, if i type
jumpI getump, and of course a 'jj' escapes to command mode.I prefer a 'kj' mapping which means I can use a 'kk' for a single 'k' in Atom, but this will get old very quickly.
So how can we avoid throwing away the first letter of the command?
Is this likely to be a small task or delving into Atom internals?
drbraden commentedon May 9, 2014
Oh, oops, you're right. I guess I just haven't had to type a j in insert mode since I made the change. It works fine in vim and sublime.
It looks like there is an "operator-pending" mode that might be used to get this functionality without discarding the first key when subsequent keys don't match a mapping. It's in the master branch, but it's not in the current release, yet.
In master, they use operator-pending mode to implement "d i w" while in command mode, so I played around a bit trying to do something similar, but so far I haven't been able to get it to work.
nathansobo commentedon May 9, 2014
I've created atom/atom-keymap#16 to track the integration of
textinputevents with multi-keystroke bindings. Fixing that still won't allow for multi-key chords, but at least provides better support for the typicalj kescape bindings.I've also created atom/atom-keymap#17 to track support for chords, which is more sophisticated. In time, this is all reasonable, but I personally won't be able to get to it until our plans for the editor renderer are more stable.
drbraden commentedon Jun 26, 2015
Here is a currently working method (as of v1.0.0) of exiting insert mode with "jj" (or the more common "jk" with a minor edit to the keymap.cson change):
Credit for this goes to @rdlugosz for his comment at #334 (comment)
oh-its-jimjam commentedon Jun 29, 2015
@drbraden Thanks for the code snippet! I wanted to map 'jj' to escape in Atom and you've saved me a lot of time 👍
drbraden commentedon Jun 30, 2015
@lambdaburrito Glad to hear it! I've spent way too much time chasing down a solution for this, or finding a new one after a breaking upgrade, so I was hoping I could save others the time 😄
AriaMinaei commentedon Jul 4, 2015
Thanks @drbraden! Here is a one-line modification of your code snippet, using
editor.buffer.undo()instead ofeditor.backspace()to preserve selections:AriaMinaei commentedon Jul 5, 2015
Looks like
editor.buffer.undo()undoes keystrokes in batch, so, ignore my last comment :)maxbrunsfeld commentedon Jul 24, 2015
We've fixed this bug. In the next Atom release (v1.0.3), you'll just have to do this:
SurenderLohia commentedon Aug 4, 2015
@maxbrunsfeld +1
Adding my atom config BECAUSE I GOT jk working in vim mode!!!