pkazmierczak
pkazmierczak

Reputation: 853

Overriding default key bindings in Sublime Text 2/Plain Tasks

I have a problem overriding some default key mapping for PlainTasks plugin in ST2. The plugin defines alt+c and alt+o shortcuts that I use for inputing Polish characters, so I added the following lines to my Packages/User/Default (OSX).sublime-keymap:

// ć and ó for PlainTasks
{ "keys": ["super+alt+c"], "command": "plain_tasks_cancel", "context": [{"key": "selector", "operator": "equal", "operand": "text.todo" }] },
{ "keys": ["super+alt+o"], "command": "plain_tasks_open_link","context": [{ "key": "selector", "operator": "equal", "operand": "text.todo" }] }

However, PlainTasks keeps ignoring my own settings. If I change Packages/PlainTasks/Default (OSX).sublime-keymap, it will be overwritten with defaults the next time I open ST2 or the next time Package Control updates the packages, I'm not sure.

And ideas why this happens?

Upvotes: 3

Views: 2897

Answers (3)

qbolec
qbolec

Reputation: 5134

I had a similar problem, but the solution of skuroda didn't help me. The reason, I belive, is that on "Polish programmer keyboard" the right alt key is actually mapped to ctrl+alt combo. Therefore I had to put "ctrl+alt+c" as keys. I found this hint at https://www.opensoft.com.pl/article/sublime-keys

Upvotes: 0

skuroda
skuroda

Reputation: 19754

I took a quick look at the key bindings and they use context appropriately, so there is no problem with them reusing the super+d binding. In addition to your rebindings for the plain task commands, you also need to do rebind the input keys in your user key bindings. Insert the following entries in your user key bindings as well.

{"keys": ["alt+c"], "command": "insert", "args": {"characters": "ć"}},
{"keys": ["alt+o"], "command": "insert", "args": {"characters": "ó"}}

Upvotes: 4

MattDMo
MattDMo

Reputation: 102922

I would suggest opening a new issue on Github requesting they change the key bindings. You can reference this part of the documentation that says Option+<alphanum> should not be used for any OS X key bindings, as it causes the exact problem you're seeing.

You might also want to point them toward skuroda'sFindKeyConflicts plugin, as I noticed that at least one of their key bindings (D) conflicts with a built-in Sublime shortcut (expand selection to word).

Upvotes: 3

Related Questions