Sublime Forum

Keymap (key bindings) only for py file

#1

I want to define some key bindings for py files. but I don’t want change the (default) command of any key for other files. Or I want define the same key binding for files of different types with different functions or effects. Is that possible? What should I do?

I know we can build a plugin define a TextCommand then use self.get_file_type() to get the type of current file, then … But it is not convenient.

0 Likes

#2

why not just use "context": [ { "key": "selector", "operator": "equal", "operand": "source.python", "match_all": true } ] in your keybinding?

4 Likes