Sublime Forum

Suggestion: Right Mouse for Column Select

#1

Not sure why it is necessary to hold the Middle mouse button when you want to column select something with the mouse. The other option is to use right mouse button while you are holding shift. But if you are holding the right mouse button and dragging why not just let that be the column select? Holding right mouse and dragging does nothing else right now. Why require the middle mouse?

I am also used to visual studio which uses just holding ALT with left mouse button for this. Would be nice if it were possible to enable that same functionality.

0 Likes

#2

Right click is currently the context menu. You can either overwrite it and only column select or column select and open the context menu afterwards. Something like “Open Context menu unless dragging appeared” is currently not natively supported.

0 Likes

#3

Hmm… Where/How does one even customize the mouse buttons? I don’t see any mouse button inputs in the key bindings settings. Nor do I see where the shift key is setup to work as the column select modifier.

Apologies as I am a Sublime noobie.

0 Likes

#4

The mouse binding are in a separate file you cannot access via the menu. The easiest way to edit it is to open the ST console ctrl+` and paste:

window.run_command("edit_settings", {"base_file": "${packages}/Default/Default ($platform).sublime-mousemap", "default": "[\n\t$0\n]\n"})

(Assuming you are using a recent ST3)

0 Likes

#5

Aha! thanks. Man seems like something to keep a shortcut button handy for. Is it possible to add your own menu commands? Or I guess that might be a macro then.

Also are you using some kind of tool to capture that text for the console?

This would be a simpler way to type it is why I ask

window.run_command(“edit_settings”, {“base_file”: “${packages}/Default/Default ($platform).sublime-mousemap”, “default”: “[ ]”})

0 Likes

#6

Menus are indeed editable as well. Similar to what @r-stein mentioned above, you can use a command like this to open the default Main.sublime-menu file and create your own User package customization to add items to it:

window.run_command("edit_settings", {"base_file": "${packages}/Default/Main.sublime-menu", "default": "[\n\t$0\n]\n"})

More information on this is available in the Unofficial documentation on menus.

0 Likes

#7

Excellent. Thanks. Just added a “Custom” menu for my own commands. Liking the power of sublime already. :wink:

[
	{
        "caption": "Custom",
        "mnemonic": "n",
        "id": "custom",
        "children":
        [
            {
                "command": "edit_settings", "args":
                {
                    "base_file": "${packages}/Default/Default ($platform).sublime-mousemap",
                    "default": "[\n\t$0\n]\n"
                },
                "caption": "Mouse Bindings"
            },
        ]
    },
]
0 Likes

#8

You can also integrate it into the existing Preferences Menu (just use the same id to join menus; only use the caption to change it, e.g. for localization):

[
    {
        "id": "preferences",
        "children":
        [
            {
                "command": "edit_settings",
                "args": {
                    "base_file": "${packages}/Default/Default ($platform).sublime-mousemap",
                    "default": "[\n\t$0\n]\n"
                },
                "caption": "Mouse Bindings"
            },
        ]
    },
]

PS: You should not use the same mnemonic for different menus, you can just omit it.

0 Likes

#9

Aha I see. Excellent thanks. i was wondering how one would interject something like that

0 Likes

#10

Is there any way to force an entry to be inserted at a particular point in the default array though?

0 Likes

#11

Without creating a direct override of the Main.sublime-menu from the Default package, the best you can do is tell Sublime the general area of the menu by using the same ID, but all packages that want to inject menu items get their data appended to the same section of the menu (in the order that the packages are loaded).

Creating such an override isn’t a good idea as your override will always be in play even if an updated sublime adds/modifies/fixes the menu. In that case the official changes are ignored in favor of your override but you get no notification that it’s happening.

0 Likes