To select a column in Sublime Text (on Windows) you use Shift+Right Click
.
How can I change the mouse button and modifier key to Alt+Left Click
so it is the same as Notepad++?
I found a similar question/answer here on StackOverflow but it did not work.
Here is my Default (Windows).sublime-mousemap
file but nothing happens when I press Alt+Left-Click
or Alt+Right-Click
.
[
{
"keys": ["ctrl+s"], "command": "run_multiple_commands", "args": {"commands": [ {"command": "save"}, {"command": "create_backup_copy" } ] }
},
// toggle fold all
{
"keys": ["f12"], "command": "fold_all"
},
//toggle fold current code block
{
"keys": ["f11"], "command": "toggle_fold_current"
},
//alt+ left click column select
{
"button": "button1", "modifiers": ["shift"],
"press_command": "drag_select",
"press_args": {"by": "columns"}
},
{
"button": "button1", "modifiers": ["shift", "ctrl"],
"press_command": "drag_select",
"press_args": {"by": "columns", "additive": true}
},
{
"button": "button1", "modifiers": ["shift", "alt"],
"press_command": "drag_select",
"press_args": {"by": "columns", "subtractive": true}
},
//re-open recent file
{
"keys": ["ctrl+shift+t"], "command": "open_recent_file", "args": {"index" : 0}
},
]
Your Default (Windows).sublime-mousemap
is a very strange looking sublime-mousemap
. It should not contain any key bindings at all but for some reason it contains key bindings to call the run_multiple_commands
, fold_all
, toggle_fold_current
, and open_recent_file
commands.
Those key bindings should be in Default (Windows).sublime-keymap
and not in Default (Windows).sublime-mousemap
.
I think you might have added the Alt+Left Click
code to your user sublime-keymap
file instead of a user sublime-mousemap
file and you didn't change the modifier key from Shift
to Alt
.
The StackOverflow code that you found here looks correct to me. I have posted it again below. Copy and paste it into a new file and save it in your Sublime Text config User
directory as Default (Windows).sublime-mousemap
. On Windows that path should be as I've shown below, or something like that, the directory should be the same one as your user key bindings file is in:
%APPDATA%\Sublime Text 3\Packages\User\Default (Windows).sublime-mousemap
Copy and paste this code (credit: Mr.F):
[
{
"button": "button1", "modifiers": ["alt"],
"press_command": "drag_select",
"press_args": {"by": "columns"}
},
{
"button": "button1", "modifiers": ["alt", "ctrl"],
"press_command": "drag_select",
"press_args": {"by": "columns", "additive": true}
},
{
"button": "button1", "modifiers": ["shift", "alt"],
"press_command": "drag_select",
"press_args": {"by": "columns", "subtractive": true}
},
]
If that works for you then make sure you upvote the other answer as well as this one. I nearly marked your question for closing as a duplicate - I didn't because you are clearly confused by the different config files, and I couldn't provide the explanation within the space constraints of a comment.