sublime_text
sublime_text copied to clipboard
Mousemap contexts
I just realized that mousemaps lacks some of the keybinding goodies, like context.
E.g.:
{
"button": "button1", "count": 1, "modifiers": ["button2"],
"press_command": "fold",
"context": [
{ "key": "selection_empty", "operator": "not_equal", "operand": true, "match_all": true }
]
}
Also the middle button doesn't allow count:
{
"button": "button3", "count": 2,
"press_command": "unfold"
}
Assuming this will be fixed someday, does anyone has an idea how to detect if a text is folded or not?
(also, there is nothing in the documentation about mouse configs; at all!)
"Official" statement: http://www.sublimetext.com/forum/viewtopic.php?f=6&t=3311
Unfortunately, mousemap bindings don't support contexts at the moment though.
Interesting read/workaround idea: http://www.sublimetext.com/forum/viewtopic.php?f=6&t=11680
Regarding folded text: http://www.sublimetext.com/forum/viewtopic.php?f=6&t=10503
And yes, the docs suck.
Thanks for the links. The workaround is more or less how i imagined. I'll see what i can do with this.
:-1: for the docs.
Please, please, please allow mousemap files to provide context! I have 2 plugins that I've added double-click support to (CscopeSublime and Git) to and have had to back it out of both of them because there's no way to provide a context for mouse events.
Any update on this? Would love to get more customisable mouse maps.
We've been asking for this for 4 years now =:( Can we please get at least an update?
This got my upvote 👍 !
Specifically for running commands when hitting specific selector, I use this little wrapper command. Just drop the mousemap_wrapper.py file in your Sublime User folder to "install".
This lets me pipe my commands through like so:
{ "button": "button1", "modifiers": ["ctrl"], "command": "mousemap_wrap",
"press_command": "drag_select", "args": { "commands": [
{
"command": "anaconda_goto",
"run_for_selector": "source.python"
},
{
"command": "goto_definition",
}
]}}
This.
Also it would be great if mousemaps could be exposed via the Preferences menu like keymaps are
Contexts in mousemap files would indeed allow to make useful things.
The "context" key for mousemaps was added in build 4149.
:tada: Does it support the same keys as key bindings?
@FichteFoll the context is derived from the position of the mouse rather than the focused control but is otherwise identical.