how to change the shortcut of auto pep8 in sublime text so it formats the code when i save it.
Default.sublime-keymap
[
{ "keys": ["ctrl+8"], "command": "auto_pep8", "args": {"preview": true} },
{ "keys": ["ctrl+shift+8"], "command": "auto_pep8", "args": {"preview": false} }
]
currently i have to press ctrl+shift+8 i want to change it to ctrl+s but when i try to change it doesn't change. This file is not being edited.
Select Preferences → Key Bindings
, which opens a new window with the system default keybindings on the left and the user keybindings on the right. Copy the keybindings from the plugin's .sublime-keymap
file into the user file on the right, then alter them as you'd like. Hit save, and they'll be activated.
In this specific case, with your wanting to assign CtrlS, which by default is the "Save" key combo, you should add a context to the keybinding so that it only runs AutoPEP8 on Python files:
{ "keys": ["ctrl+s"],
"command": "auto_pep8",
"args": {"preview": false},
"context": {"key": "selector",
"operator": "equal",
"operand": "source.python",
"match_all": true}
}