Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mousemap contexts #105

Closed
iamntz opened this issue Jul 18, 2013 · 11 comments
Closed

Mousemap contexts #105

iamntz opened this issue Jul 18, 2013 · 11 comments

Comments

@iamntz
Copy link
Contributor

iamntz commented Jul 18, 2013

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!)

@FichteFoll
Copy link
Collaborator

FichteFoll commented Jul 18, 2013

"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.

@iamntz
Copy link
Contributor Author

iamntz commented Jul 18, 2013

Thanks for the links. The workaround is more or less how i imagined. I'll see what i can do with this.

👎 for the docs.

@vanrijn
Copy link

vanrijn commented Jul 19, 2013

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.

@AndreasBackx
Copy link

Any update on this? Would love to get more customisable mouse maps.

@vanrijn
Copy link

vanrijn commented Aug 8, 2017

We've been asking for this for 4 years now =:( Can we please get at least an update?

@asfaltboy
Copy link

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",
    }
]}}

@anentropic
Copy link

This.

Also it would be great if mousemaps could be exposed via the Preferences menu like keymaps are

@themilkman
Copy link

Contexts in mousemap files would indeed allow to make useful things.

@BenjaminSchaaf BenjaminSchaaf self-assigned this Mar 31, 2023
@BenjaminSchaaf
Copy link
Member

The "context" key for mousemaps was added in build 4149.

@FichteFoll
Copy link
Collaborator

🎉
Does it support the same keys as key bindings?

@BenjaminSchaaf
Copy link
Member

@FichteFoll the context is derived from the position of the mouse rather than the focused control but is otherwise identical.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants