Sublime Text modifying MySQL mousemap to use 4th mouse button

Using Sublime Text 3 (Build 3059) on Linux.

In the Sublime Text column, you can select the rectangular area of โ€‹โ€‹the file. When using a mouse, different mouse buttons on each platform are used for this. On OS X and Windows, the middle mouse button can be used to select a rectangle of text. On Linux, you need to use the right mouse button + shift, I think the combination is inconvenient, so instead I wanted to use the 4th button on my mouse to do this without the hassle of a modifier key.

Simply enough, I need to change the mouse display of the column selection in the default mousemap file.

Below are the relevant sections of the default mousemap files (Linux, OS X, and Windows):

// Column select Linux default mousemap file { "button": "button2", "modifiers": ["shift"], "press_command": "drag_select", "press_args": {"by": "columns"} }, // Column select is the same in the default OS X and Windows mousemap files: { "button": "button3", "press_command": "drag_select", "press_args": {"by": "columns"} }, 

So I decided that all I needed to do was use the same code as OS X and Windows, but to install "button4" instead of "button3". So I ended up with this:

 // ~/.config/sublime-text-3/Packages/User/Default (Linux).sublime-mousemap [ // Map column select to 4th mouse button. { "button": "button4", "press_command": "drag_select", "press_args": {"by": "columns"} } ] 

Everything is very logical and understandable, except that it does not work . Pressing the 4th mouse button does not make a column selection; it just does nothing. What's wrong?!

+3
sublimetext2 sublimetext sublimetext3
source share
1 answer

It took me a while to figure this out, but ...

On Linux, the 4th mouse button does not necessarily refer to "button4". In fact, on my system the 4th mouse button refers to "button8". All that was needed was to use "button8", where before I used the button "button4".

 [ // Map column selection to 4th mouse button ("button8"). { "button": "button8", "press_command": "drag_select", "press_args": {"by": "columns"} } ] 

Hope this helps someone.


EDIT: UNIX / Linux users can use xev , which prints the contents of X events to get their button numbers.

+6
source share

All Articles