How to fix the one step delay for Atom text editor?


#1

I’ve been using Atom recently and loving it. There is one problem though. I’d like to move around the insertion point without leaving the home row. I set up my keymap to something as seen in the below picture.

I can move left and right without any problems, but when I try to go up or down, I need to press the key twice to put it in effect. There is one key delay, which is very very strange. Does anyone know how to fix it?

Any suggestions appreciated.


Issue with keybindings
Issue with keybindings
#2

Atom has many keybindings that start with ctrl-k, for example ctrl-k up/left/right/down (pane:split-...) and ctrl-k ctrl-[0-9] (editor:fold-at-indent-level-...).
When you press ctrl-k, the editor waits one or two seconds, which gives you enough time to press another key (like up) to execute the correct command (in this case ctrl-k up = pane:split-up).
If you don’t press another key during that delay or you press the same key again (assuming that there is no keybinding ctrl-k ctrl-k) then your keymap’s ctrl-k will be executed.

To remove this delay you could either:

  • Change your keymap and bind those commands to other keys.

  • Remove all keybindings that start with ctrl-j/k/h/l (by adding them to your keymap as unset!).

In both cases you could take a look at the Keybindings page in Atom’s settings and key-binding-resolver (ctrl-. on my machine) to see all currently used keybindings and configure your keymap properly.


#3

@deprint thank you, I changed all the keymap to ctrl-shift-j/k/h/l, and it worked!


#4

Hi, I changed all the keymap to ctrl-shift-j/k/h/l. They were working great, but I decided to use ctrl-j/k/h/l after all, and I discovered some seriously interesting aspect of Atom.
Take a look at the picture below.

According to @deprint, we need to remove all keybindings that start with ctrl-j/k/h/l by using unset!, so I disabled all of them, but I found out ctrl-l and ctrl-j weren’t working regardless. I had no idea why, but after I added 'ctrl-l': 'core:move-right' and 'ctrl-j': 'core:move-down' inside'atom-workspace atom-text-editor:not([mini])', everything worked!! The keybindings in the picture is the complete working keybindings for linux user. You might have to change small things if you are a mac user or have other packages you installed.


#5

Atom Flight Manual covers the keymap pretty well. I recommend you read the part about Specificity and Cascade Order.

In your case, ctrl-l (editor:select-line) uses the selector atom-workspace atom-text-editor and ctrl-j (editor:join-lines) uses atom-workspace atom-text-editor:not([mini]). You can’t override these two keystrokes in atom-text-editor, because both atom-workspace atom-text-editor and atom-workspace atom-text-editor:not([mini]) are matched first.

Configuring a custom keymap can be a little difficult in atom. I’m actually working on a package that would allow some more advanced keymap configurations, but it’s still a work in progress and I don’t plan on releasing it before this weekend. If you opened your thread a week later, I probably would have provided an easier solution. One that does not require unset!ing two dozen keybindings manually :wink:


#6

See http://specificity.keegan.st.