Skip to content
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

Restrain keystroke to scope (or filetype). #67

Open
Strauman opened this issue Apr 27, 2018 · 3 comments
Open

Restrain keystroke to scope (or filetype). #67

Strauman opened this issue Apr 27, 2018 · 3 comments

Comments

@Strauman
Copy link

Strauman commented Apr 27, 2018

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.

@Strauman Strauman changed the title Restrain keystroke to scope. Restrain keystroke to scope (or filetype). Apr 27, 2018
@morassman
Copy link
Owner

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

@Strauman
Copy link
Author

Strauman commented Jul 2, 2018

@morassman Awesome!

@Strauman
Copy link
Author

Strauman commented Feb 20, 2019

(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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants