1
votes

In Sublime Text 2 or 3 (I use both, and the answer is probably the same for both), how do you change the hotkey of an installed plugin/package? (on Windows or Linux / Ubuntu)

I already know how to change the key bindings of built-in Sublime commands (Preferences > Key Bindings). For instance, one binding I already have is:

{"keys": ["ctrl+super+b"], "command": "show_panel", "args": {"panel": "output.exec"}}

But in the case of a plugin, how do I know what string to use for "command"? Is there an easy way to find out what the "command" is for an arbitrary function in Sublime?

I would like a general answer that applies to any plugin one could install. Though as an example, today I'm trying to change the hotkey for a plugin called SimpleClone, which has assigned Ctrl+Shift+Right to Split Right. Ctrl+Shift+Right is a rather poor hotkey choice by the maker of the plugin since it already has a use in the operating system: when typing it selects the word to the right. Hence I want to change the assigned key binding.

3

3 Answers

1
votes

If plugin has some shortcuts defined, they will be in the *.sublime-keymap files. So if you want to find some shortcut I guess you could grep through all the *.sublime-keymap files in Packages directories, but if you roughly know which plugin uses that shortcut you want to change that shouldn't be necessary :)

For example the Emmet plugin has keybindings defined in: Packages/Emmet/Default (Platform).sublime-keymap.

You can copy the keybinding definitions from these files to your user keybindings file (Packages/User/Default (platform).sublime-keymap) and modify them as you want.

1
votes

You can do the following:

  1. Go to "Menu->Preferences->Browse packages..."
  2. Find the directory of the interested package.
  3. Find file with ".sublime-commands" extension.
  4. Get command name from file.
  5. Use "Menu->Preferences->Key bindings" for add key binding.

Ex (StringUtilities):

[
    { "keys": ["ctrl+b"], "command": "convert_to_base64" },
    { "keys": ["ctrl+shift+b"], "command": "convert_from_base64" },
    { "keys": ["ctrl+u"], "command": "url_encode" },
    { "keys": ["ctrl+shift+u"], "command": "url_decode" }
]
0
votes

You can open Packages list by pressing Cmd-Shift-P (on Windows should be Ctrl-Shift-P), choosing Package Control: list packages then select the package you neeed and press Enter. Sublime will open package directory where you can find all desired *.sublime-keymap files.