Sublime Forum

Dev Build 2041

#1

Dev Build 2041 is out now. The main feature is configurable mouse input, via the new *.sublime-mousemap files. With these, you can bind commands against buttons, buttons with modifiers, the scroll wheel, and chorded buttons (e.g., button 1 pressed while button 2 is held down). I’ve added a few to start with, but we’ll see how things go:

  • Hold down the right mouse button (aka button 2), and scroll with the mouse wheel to change files. Opera was the clear inspiration here. This happens on Windows and Linux only, as on OS X the context menu is shown as soon as button 2 is depressed.

  • Buttons 4 and 5 also go to the next / prev file.

  • Hold button 2, and then:

  • Click button 1: select line

  • Double click button 1: select paragraph

  • Triple click button 1: select all
    (again, not on OS X)

Anyway, have a play, and let me know what you think. The sublime-mousemap files work a lot like the keymap ones, in that they’re platform specific, and you can override them by putting a file with the same name in your User directory.

The quote pairing changes deserve pointing out too: previously, they’d sometimes insert two quotes when you only want one, e.g., when trying to close a string after deleting the end quote. This shouldn’t be an issue any more.

Keyboard input has also been reworked, although for the most part you won’t notice any difference. Some of the changes:

  • For keys that emit characters, e.g., ‘a’, ‘1’, ‘.’ (but not tab, space, enter), the key name to bind against is the unshifted character on the key, e.g., ‘.’ rather than ‘period’ now. The old names will continue to work, however.

  • On OS X and Linux, all keys are now bindable. For example, with a German keyboard layout, you can bind “Ctrl+ö”, whereas you couldn’t before. Windows continues to work the same way as it did previously, where you have to bind against the virtual key code (e.g., Ctrl+` to trigger on the ö key).

  • On Linux, the key names displayed in the menu are now sensible.

There are a few other misc changes too: window positions are restored in Linux, Command+C etc work in OS X open and save dialogs, and Ctrl+W/Command+W are able to close the window. The full list of changes is on the Dev Build page, as usual.

0 Likes

#2

Contexts aren’t supported in mousemaps, but there’s no reason they couldn’t be - just need some compelling examples to justify the code.

I’m planning to add mouse gestures in the future, but it needs UI support to be done properly, and there are other things that need doing first.

0 Likes

#3

Here’s an example of something else that can be done in the mousemap:

{
	"button": "button4", "modifiers": "ctrl"],
	"command": "cut", "press_command": "drag_select"
}

This will let you select a block of text with ctrl+mouse4, and the text will be cut as soon as you release the button.

0 Likes

#4

This sounds pretty interesting:

Build files may specify environment variables, using the env key
Added build_env file preference, which will be picked up by the build system
Added env file preference, which will be picked up by the build system

Could you elaborate on how this works?

0 Likes

#5

Now all I need is my 8-button mouse!

0 Likes

#6

Not sure if that’s related but the thing I wanted to do is to put “Copy full file path” item into tab’s context menu.

So I’ve added:
" { “command”: “copy_path”, “caption”: “Copy Full File Path” }, "
to “Tab Context.sublime-menu”.

and that works but only on active tab. If I use it on background tab then it still copies path of active file.

So if that’s somehow related to your work done here, then maybe it’s easy to fix now.

0 Likes

#7

[quote=“sublimator”]
Seems exec takes env keyword arg for per run configuration, seemingly expecting a mapping like {“BLA”: “BLA”}.

There’s also a settings key build_env which takes a map. I’m assuming the run env vars win[/quote]

I guess so. I haven’t downloaded the build yet, was hoping for easy answers :smile:

0 Likes

#8

Take for example “left click on a link opens an url”. I’ve written a syntax file and a TextCommand. With mouse bindings I would also be able to trigger this TextCommand via a left click. Currently it’s only triggered when in the correct scope and pressing enter.

PS: I’m currently writing something like orgmode. Of course it does not have all the bells and whistles yet, but mouse interaction is one thing I would need/want anyway for this project.

0 Likes

#9

Or another example:
My orgmode plugin has checkboxes. These can currently be toggled by bringing the cursor over them (correct scope) and hitting return. This could also be triggered alternatively by a left click.

0 Likes

#10

[quote=“theblacklion”]Or another example:
My orgmode plugin has checkboxes. These can currently be toggled by bringing the cursor over them (correct scope) and hitting return. This could also be triggered alternatively by a left click.[/quote]

I take it the context would be that the mouse click is between ] right?

0 Likes

#11

[quote=“jbrooksuk”]

[quote=“theblacklion”]Or another example:
My orgmode plugin has checkboxes. These can currently be toggled by bringing the cursor over them (correct scope) and hitting return. This could also be triggered alternatively by a left click.[/quote]

I take it the context would be that the mouse click is between ] right?[/quote]

The scope currently covers the brackets. So it would be anywhere on or between these.

0 Likes

#12

Jon, I’ve an issue with the key bindings on OSX. When defining super+shift+o for example, it requires me to define super+shift+O. This is obviously strange and only applies to super+shift+something bindings.

0 Likes

#13

I feel as if I was in a flight simulator… My mouse wheel scrolls the screen in the opposite direction :smile:

0 Likes

#14

BUG:? Double clicking a file in the sidebar (as is customary to open a file on windows) will open the file directly above the file clicked on (in the sidebar dir tree).

0 Likes

#15

I’m really excited about the mouse commands!

Quick question: if I log_commands and click around, it prints a fair amount of information:

command: mouse_test {"event": {"button": 1, "x": 426, "y": 246}, "subtractive": true}

But if I make a test command, and print out the args and kwargs, I don’t get any of that sweet mouse information:

code
(‘kwargs:’, {‘subtractive’: True})
[/code]
Is there any way to access this? Perhaps also a command like view.rowcol(x_coord, y_coord)?

0 Likes

#16

Am I supposed to be able to edit a file while the Goto Anything panel is up? If I bring up the panel and select a file but don’t hit Return, I can click in the previewed file to activate it, and then I can edit it, scroll around, etc., all while the GA panel just hangs out in front. Not sure if this is intended behavior.

0 Likes

#17

Thanks for pointing this out! I thought I was going insane…

0 Likes

#18

The new mousemap files are great. It is a very innovative idea.
It would be great if you could target specific areas of the UI as well.
This would allow for configuring things like double clicking on the tab bar for a new file or triple-click for open.
Hold right-click and click left to save all, double-click to close a tab, hold ctrl and click left on a tab to save … you get the idea.
This would be even more useful when interacting with the sidebar.

0 Likes

#19

[quote=“tstrokes”]The new mousemap files are great. It is a very innovative idea.
It would be great if you could target specific areas of the UI as well.
This would allow for configuring things like double clicking on the tab bar for a new file or triple-click for open.
Hold right-click and click left to save all, double-click to close a tab, hold ctrl and click left on a tab to save … you get the idea.
This would be even more useful when interacting with the sidebar.[/quote]

Things like tabs could then be caught via context - I want to have context support ^^.

0 Likes

#20

I’m on OS X and switching between tabs with the keyboard shortcut is not working reliably. Previously, using CMD+SHIFT+} to go to the next tab worked very well but after this update it seems to break when ST2 loses focus. I’m forced to go to the File->Switch Files->Next File menu item and then the keyboard shortcuts seem to start working again.

I can’t reproduce the problem with 100% certainty and at first I thought it was my imagination. But it’s happened several times in the past several hours and I’m pretty sure its a bug. If there is a better place to file a bug report please let me know and I’ll make it official. :smile:

Thanx!
Richard

0 Likes