morassman/process-palette

Restrain keystroke to scope (or filetype).

Strauman opened this issue · 3 comments

Motivation

Being able to use the same short cut for multiple processes based on the current file

Example usage

Making custom beautifiers all having the same shortcut key.

For example you want to use cmd-alt-b for beautifying a file.
Then you could invoke js-beautify in a .source.js scope using cmd-alt-b, and latexindent.pl in a source.tex scope with the same shortcut.

Suggested implementation

As you may know, Atom has scopes. One could restrict a keybinding command to a scope, which would make this work nicely.

Hi @Strauman
I can see how this can be very useful. I'll look into it for possibly the next update.

@morassman Awesome!

(Maybe also helpful for implementing this?)

A workaround could be, as per in Atom's Keymaps In-Depth

"atom-text-editor[data-grammar~='SCOPE']":
  'SHORTCUT': 'NAMESPACE:ACTION'
  • SCOPE is the name (not selector) of the current scope (e.g. python)
  • SHORTCUT is the key binding you want. (e.g. ctrl-alt-b)
  • NAMESPACE and ACTION should match what you enter into the config when you create a command in process-palette.