Home Download Buy Blog Forum Support

Key binding context confusion (order matters)

Key binding context confusion (order matters)

Postby voxmea on Wed Aug 10, 2011 7:01 pm

I have the following in my Default.sublime-keymap:

Code: Select all
   
    { "keys": ["/"], "command": "close_tag_on_slash",
      "context": { "key": "setting.command_mode", "operator": "equal", "operand": false } },
    { "keys": ["/"], "command": "show_panel", "args": {"panel": "find", "reverse": false},
        "context": [{"key": "setting.command_mode"}]
    },


If I reverse the ordering (have close_tag_on_slash come after "show_panel"), then "/" no longer opens the find panel and instead inserts a "/" when I'm in command mode. I assume this is because I've got the context for "close_tag_on_slash" wrong? Any suggestions on how to have "close_tag_on_slash" trigger only when in Vintage insert mode other than rely on ordering? Clearly I don't understand contexts yet. Thanks!
voxmea
 
Posts: 28
Joined: Fri Feb 04, 2011 10:02 pm

Re: Key binding context confusion (order matters)

Postby jps on Wed Aug 10, 2011 9:59 pm

In the first key binding, context needs to be an array, rather than an object - I'll update the next build to print a warning on the console when this happens
jps
Site Admin
 
Posts: 3067
Joined: Wed Mar 19, 2008 12:33 pm

Re: Key binding context confusion (order matters)

Postby voxmea on Thu Aug 11, 2011 1:22 am

Oh duh, thanks!
voxmea
 
Posts: 28
Joined: Fri Feb 04, 2011 10:02 pm


Return to General Discussion

Who is online

Users browsing this forum: excalibur1976, Mondo, vaselinessa and 45 guests