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

Add ability to register local command keys in atom workspace #1070

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

rly
Copy link

@rly rly commented Jun 12, 2020

As far as I can tell, local commands (plugins) cannot be assigned to atom commands for the purpose of keymapping. For example, it would be nice to be able to map the "compile" command to a keyboard shortcut. This PR adds an optional field to the command body called "action" that specifies the name to associate with the command for use in the keymap.

Example in the command plugin index.coffee:

  "compile":
    "description": "Compiles the currently opened C/C++ file using g++."
    "command": (state, args)->
      [cut]
      state.exec "#{COMPILER_NAME} #{COMPILER_FLAGS} \"#{SOURCE_FILE}\" -o \"#{TARGET_FILE}\" #{ADDITIONAL_FLAGS}", args, state
      return ""
    "action": "run-compile"

And in the keymap atp.cson or Atom user keymap:

'.platform-darwin atom-workspace':
  [cut]
  'ctrl-`': 'atom-terminal-panel:toggle'
  'ctrl-shift-c': 'atom-terminal-panel:run-compile'

The key combo "ctrl-shift-c" would then run the "compile" command.

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

Successfully merging this pull request may close these issues.

None yet

1 participant