Keymaps don't work on startup? [solved]


#1

I edited my keymap.cson to run commands, but strangely, none of them work when I try them on startup. According the the resolver, they should be working, but nothing happens at all. The strange part is that after I use the command palette to run the command I want, the keymap suddenly starts working for some reason.

Any ideas?


#2

Can you please answer the following questions:

  • What are the keybindings and commands you have entered?
  • Does it also fail for core: commands, or just third party package commands?
  • Can you replicate this behavior when you start Atom in safe mode (atom --safe in the terminal)

#3

Uh, yeah. Maybe it’s better if I show you my keymap.cson file. As you can see, I tried a bunch of things:

'atom-workspace':
    'ctrl-t': 'atom-terminal:open'
'atom-workspace atom-text-editor:not([mini])':
    'ctrl-shift-up': 'editor:move-line-up'
    'ctrl-shift-down': 'editor:move-line-down'
'.platform-linux atom-workspace atom-text-editor:not(.mini)':
    'ctrl-up': 'ctrl-dir-scroll:scroll-up-big'
    'ctrl-down': 'ctrl-dir-scroll:scroll-down-big'
'editor':
    'ctrl-up': 'unset!'
    'ctrl-down': 'unset!'

#4

Can you show a screenshot of what you’re seeing in the Keybinding Resolver? It may be that you’re misreading what it shows.


#5

Do your keybinds correspond with commands that are part of a package’s activationCommands?

I don’t have the time right now to test my theory, but that sounds like activationCommands are somehow interfering with the keybinds, even though the package should be activated when a keybind triggers a command.


#6

Ok. Here’s an example. I have the Package “atom-terminal”, and I set the keybinding as seen above. I bound it to ctrl-t.
Here’s the keybinding resolver:


#7

I was able to map Cmd+T (the OS X equivalent for fuzzy-finder:toggle-file-finder) to something using the atom-workspace selector with no issue. It works just after startup, first time and every time … I didn’t map it to atom-terminal though because I don’t use that package. I have a custom command that opens my text file todo list.

When I installed the atom-terminal package on the other hand and tried to replicate your issue, it does occur. And as @Alchiadus points out, atom-terminal does have activation commands. And it would appear that both of atom-terminal’s activation commands are listed in the package.json:

But if you look at the version that is in the latest released version, v0.8.0:

atom-terminal:open is not in the list of activation commands. So when you execute a command from the command palette, you must be using atom-terminal:open-project-root and not atom-terminal:open. Because when I open the command palette immediately after startup and try to find atom-terminal commands, this is all I see:

So I would urge the atom-terminal owner to release v0.8.1 where this shouldn’t be a problem.


#8

Excellent, that helped me fix the other issues. Thank you.


#9

Since this is resolved, I’m going to close the topic unless there are any more questions.


#10

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.