Allow customization of mouse shortcuts
Some users would like to be able to customize not just pure keyboard shortcuts but also mouse + modifier ones. These are currently hard coded, for example alt+click to add a selection.
See https://github.com/Microsoft/vscode/issues/3091 for some more context.
+1
I would like to do shift+cmd+leftMouseButton for Peek Definition, would be a perfect combination for me.
+1
I've found an interesting performance implication resulting from the current defaults/lack of configurability. Consider the hard-coded modifier associated with the "peek definition" functionality. If a plugin must do some work to provide the definition, it's very likely VSCode will ask plugins for definition information even when the user has no intention of obtaining it. As I describe in https://github.com/Microsoft/vscode-go/issues/257#issuecomment-198993769:
For example, with the cursor resting still in the editor area, pressing ⌘ instantly invokes the GoDefinitionProvider, even when ⌘ is immediately used in a chord for some other command (e.g. copy, paste, opening the command palette, etc.).
This means calls to godef are happening when the user is pressing a very common key with no intention of obtaining contextual hover information.
When using vscode-go, this means significant extraneous energy usage which could be avoided almost entirely by providing modifier key settings for "peek definition". Not only would the feature be convenient and allow for better host OS GUI integration, but VSCode would be more CPU-efficient for common usages.
+1 – Atom, Sublime and jsbin.com (presumably others, too) all allow creation of multiple cursors with ⌘+click (on a Mac, at least). It'd be good to be forced to learn as few new shortcuts as possible when switching to a new editor.
I'm just completely avoiding using alt+click to add cursors until I can customize to make Windows and Linux consistent. Don't want to build muscle memory when it's going to change later.
@alexandrudima any thoughts on when you could get to this? It's blocking adding cursors via mouse on Linux. I can take a shot at it if you give a high level approach.
+1 I just discovered VS Code and I'm loving it, but as a long time Sublime Text user on Linux, I'm missing the ctrl + click ability. Would love to be able to customize mouse shortcuts.
From @ChristopherHaws in #6853
- VSCode Version: 1.1.1
- OS Version: Windows 10 Pro
In Visual Studio (full version), I tend to turn off the Ctrl+LeftMouseClick go to definition feature. I personally prefer to have Ctrl+LeftMouseClick select the entire word under my mouse cursor.
From what I can see, mouse events are not configurable at the moment, and they are also not possible to override with extensions (to the best of my knowledge). It would be really nice to have a mouse mapping configuration file. Sublime Text has this (although it is sort of a hidden feature that is not exposed through the UI). Just as an example, my sublime text mousemap file looks like this:
[ { "button": "button1", "count": 1, "modifiers": ["ctrl"], "press_command": "drag_select", "press_args": {"by": "words"} } ]
+1 for customization. I'd like using CTRL to multi-select instead of alt.
I would like to note, that adding cursors with the mouse is impossible on Linux, because alt+click is already used to move the window around (at least on KDE and XFCE), and therefore the alt+click behavior doesn't reach the code editor at all. So I would also suggest to change the default binding to something that doesn't conflict with key combinations of major window managers. Ctrl+Alt+click could work,
I would like to note, that adding cursors with the mouse is impossible on Linux, because alt+click is already used to move the window around (at least on KDE and XFCE), and therefore the alt+click behavior doesn't reach the code editor at all. So I would also suggest to change the default binding to something that doesn't conflict with key combinations of major window managers. Ctrl+Alt+click could work,
Please don't change the default. Using Alt to move Windows around is a bad default, e. g. Inkscape also has problem with this. The Windows key is much better suited for this, as it is more often used for "window manager" shortcuts, e. g. on Windows. Furthermore even the name makes more sense: "Windows key" -> "move windows around". It's also GNOME's default.
IIRC the choice of using Alt as the default for this was also a workaround, because the Windows key didn't act as a real "meta" key. Last time I checked I still couldn't map the Windows key to open the menu in XFCE and move windows around with it at the same time.
@jhasse Ok, I think that window manager stuff should all be done with the windows key modifier is a pretty good argument. But what do you mean with "Last time I checked I still couldn't map the Windows key to open the menu in XFCE and move windows around with it at the same time."? Do you want the windows key to be a modifier and a non-modifier at the same time?
But what do you mean with "Last time I checked I still couldn't map the Windows key to open the menu in XFCE and move windows around with it at the same time."? Do you want the windows key to be a modifier and a non-modifier at the same time?
I want to open the menu by pressing the Windows key (only) while still being able to bind key combinations with it and move windows around.
Let's not get to offtopic though. This issue is only about allowing customizations which - I assume - nobody objects to.
Ok, as long as we all agree here, that not being able to customize mouse shortcuts is bad, everything is fine. I might still say though, that at the moment I am not using VS-code anymore at all, and this issue is related to it.
There is a way to override alt+mouse for window modifiers using xfwm4-tweaks-settings.

But what @jhasse is point to is what should happen if you already have Super L then once pressed, only that event is triggered and nothing else. Currently xfce defaults have nothing bound to Super L, and has ctrl+esc is bound to the window menu command xfce4-popup-whiskermenu.
I do still think that there should be a configurable way to address mouse bindings in vscode directly.
For now a workaround is to change the window manager's accessibility key from alt to super as in the image above.
@anchepiece I am not going to change my window manager settings, nor do I think that this can be barely seen as an appropriate workaround. Seeing this as an appropriate workaround is an insult to all people who got used to work with this setup for years. I won't cange my system shortcuts, just because of a stupid text editor get's in conflict with those keys, I rather avoid using the text editor.
@krux02 Completly agree. I tried it myself when it was suggested and couldn't get the hang of a new keybinding. It's would be much better to leave customization to the user.
This fixed my xenial.
gsettings set org.gnome.desktop.wm.preferences mouse-button-modifier "<Super>"
I am not sure when this feature was added, but I was able to make Ctrl+Left Click select the word under my cursor instead of going to definition.
[
{ "key": "ctrl+[mouse button]", "command": "cursorWordLeft",
"when": "editorTextFocus" },
]
@ChristopherHaws any idea where the [mouse button] definitions are declared? Or any chance you know what the binding is for a middle mouse click? I would love to try setting column selection to middle click + drag.
+1
+1 Please at least map 'multiple cursor' to an additional key map as a workaround until something gets sorted out. This was opened in Feb and most people probably just need a way to make multiple cursors in linux.
+1
Please add a reaction to this issue instead of posting "+1".
This was opened in Feb and most people probably just need a way to make multiple cursors in linux.
Multiple cursors already work fine with some DEs (like GNOME 3) on Linux. For others, see https://github.com/Microsoft/vscode/issues/3130#issuecomment-255382002 for a workaround.
@jhasse I am sorry to repeat myself, but that is a very bad workaround, that can not be seen as an ok-ish solution at all. It could only be seen as a temporary solution to show that in theory multiple cursors are technically possible, but not on something you could recommend anybody to to in practice. I am really sorry to react this way, and it might be annoying: Either you are honest and say do don't care enough because you don't think there are enough people who would benefit for the amount of work, or you fix it properly. But don't reference workarounds like that and pretend it is fixed when it is not. I am not paying for this product, so I am ok when you say you don't care, but I do care when you lie to yourself that this is not really a problem.
@jhasse last time I checked, adding a reaction doesn't make updates to the issue appear in the "participating" section of GitHub notifications. Posting a +1 comment served two purposes for me.
@krux02 You're right, a workaround is only a temporary solution. Just wanted to point out that saying "multiple cursors don't work in Linux" isn't correct. It's rather that multiple cursors don't work with some DEs. If you globally grab the Alt key on Windows, adding multiple cursors with the mouse won't work there, too.
@sharwell What about subscribing to the issue in addition to adding a reaction?
@jhasse Subscribing puts the notification in the top category here. Replying puts it in the bottom category:

I haven't had any of the workarounds that I've researched work, and I really wanted them to. I'm on Linux Mint Sarah with Cinnamon. Honestly the quickest workaround is just go back to my atom setup. I need to code, not jack with desktop settings and cross my fingers.
I have found a horrible workaround for this issue (For Windows at least). You can install AutoHotKey and use the following script which will switch only Ctrl+Click and Alt+Click.
; Switches the Left-Control-Click and Alt-Control-Click shortcut for VS Code.
; Setting for allowing dynamic titles
SetTitleMatchMode, 2
#If WinActive(" - Visual Studio Code")
^LButton::Send !{Click}
!LButton::Send ^{Click}
Return
#If
I agree that Mouse Shortcuts should be built into VSCode, I rely on them daily as well. The solution I found doesn't work when clicking on words with a linked definition.
+1 for those who come from sublime / atom and would like to use cmd+click when adding multiple cursors or the cmd+drag for dragging cursors