Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow customization of mouse shortcuts #3130

Open
Tyriar opened this issue Feb 18, 2016 · 346 comments
Open

Allow customization of mouse shortcuts #3130

Tyriar opened this issue Feb 18, 2016 · 346 comments
Assignees
Labels
feature-request Request for new features or functionality keybindings VS Code keybinding issues
Milestone

Comments

@Tyriar
Copy link
Member

Tyriar commented Feb 18, 2016

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 #3091 for some more context.

@Tyriar Tyriar added the feature-request Request for new features or functionality label Feb 18, 2016
@aegyed91
Copy link

+1

I would like to do shift+cmd+leftMouseButton for Peek Definition, would be a perfect combination for me.

@jtremback
Copy link

+1

@ironcladlou
Copy link
Contributor

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 microsoft/vscode-go#257 (comment):

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.

@davidpmccormick
Copy link

+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.

@Tyriar
Copy link
Member Author

Tyriar commented Apr 5, 2016

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.

@JulieMarie
Copy link

+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.

@Tyriar
Copy link
Member Author

Tyriar commented May 25, 2016

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"}
    }
]

@be5invis
Copy link
Contributor

be5invis commented Jul 8, 2016

+1 for customization.
I'd like using CTRL to multi-select instead of alt.

@krux02
Copy link

krux02 commented Aug 4, 2016

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,

@psychicteeth
Copy link

image

@awsms
Copy link

awsms commented Jan 31, 2024

Is there a way to get rid of the "ctrl+shift+left click" keybind that moves the text around? This has been driving me nuts for years

@AnrDaemon
Copy link

Is there a way to get rid of the "ctrl+shift+left click" keybind that moves the text around? This has been driving me nuts for years

It seems the result is a combination of multiple binds triggering simultaneously. Worth reporting as a separate issue.
Don't forget to attach a demo video.

@ghostinpeace
Copy link

If there's still a spot left for the beach house, I would love the "Right Click + Scroll Wheel" room :)

@BenMadgwick
Copy link

If you use Logitech mice with their software, you can customize mouse button mappings per application. I remapped middle-click to ⌘v (paste) for VSCode a while back.

thanks! I have a Logitech mouse so this solved my issue (for now)

@alanhoyle
Copy link

If there's still a spot left for the beach house,

For anyone who doesn't know what this is talking about:

http://xkcd.com/2881

@agbrettpittman
Copy link

Little bit early for the 8 year anniversary of this request, but happy anniversary everyone. Bumping this issue because some of us in my company would like to be able to tweak this as well.

@psychicteeth
Copy link

Happy eight-year anniversary on this issue, everyone! At least it's still open. Though maybe if they just marked it as "won't fix" we can all get some closure. @Tyriar? Put us out of our mystery? Take us out the back. A farm upstate.

I note that Rider has the same problem, even if you assign ctrl-click to select word (which I'm grateful to be able to do at least), it doesn't work if you drag select. Double click drag is apparently the new universal paradigm for block selection. More interactions is the new fewer interactions.

@Pithikos
Copy link

Pithikos commented Feb 22, 2024

It would be great to be able and set middle click as go to definition

@janhaertel
Copy link

+1

@ThaJay
Copy link

ThaJay commented Mar 27, 2024

@janhaertel Indeed, we've reached the phase where annoying them into submission is the only remaining course of action.

@tbcarver
Copy link

@psychicteeth can you elaborate on your comment, "I note that Rider has the same problem, even if you assign ctrl-click to select word (which I'm grateful to be able to do at least), it doesn't work if you drag select."
I can't find a comment or feature that allows assigning ctrl-click to select word.

Also, if there is any way to disable the ctrl-click goto feature at all, then select word and drag select will work without any issues on Windows using my previous post (it works about 95% of the time but jumps the screen about 5% of the time because of the goto feature):
#3130 (comment)

@psychicteeth
Copy link

@psychicteeth can you elaborate on your comment, "I note that Rider has the same problem, even if you assign ctrl-click to select word (which I'm grateful to be able to do at least), it doesn't work if you drag select." I can't find a comment or feature that allows assigning ctrl-click to select word.

Also, if there is any way to disable the ctrl-click goto feature at all, then select word and drag select will work without any issues on Windows using my previous post (it works about 95% of the time but jumps the screen about 5% of the time because of the goto feature): #3130 (comment)

Sure, if you go into the keymap and assign Ctrl-click to Extend Selection, and remove it from Go To Definition, you get the behaviour I describe
image
However, this does not support Visuall Studio's default of being able to drag-select by word while holding control down. The functionality exists, because it's what happens if you double click a word to select it but then drag from the second click. This allows you to select multiple words. You jsut can't make it happen using ctrl-click in Rider.

@tbcarver
Copy link

@psychicteeth ok I think you are referring to Visual Studio and its features, but the thread is about Visual Studio Code. If you are referring to Visual Studio and not Code you probably want to open a ticket on the Visual Studio support forums. However, if you are referring to Visual Studio Code please help me understand how you have that menu in Code.

Thanks!

@stevekm
Copy link

stevekm commented Mar 28, 2024

I keep on ending here because not being able to do so creates a very annoying issue with the integrated terminal. Let say you want to copy text from the terminal. You need to do that with Ctrl+Shift+C But there is also Ctrl+click which tries to open a "link" to the text under the mouse. There is a very annoying timing issue there. If you do the whole click + Ctrl+Shift+C quickly (happens like 70% of the time) then you end up having the Ctrl+click to open link being seen first => the terminal focus is lost you end up with a search of a word in the workspace. And thus your first intention is lost...

I even had to remove the Ctrl+Shift+C shortcut to open in new external terminal cause it was fired instead of what i wanted. Very annoying. I think the mouse customization would help there.

EDIT: i also realize that the issue comes from the fact that now simply every single word is recognized as a link in the terminal

I think you may want to consider trying "Copy on Selection" https://code.visualstudio.com/updates/v1_20#_copy-on-selection
so that simply highlighting text in the Integrated Terminal will automatically copy it
then you can Paste it with your choice of methods

@psychicteeth
Copy link

@psychicteeth ok I think you are referring to Visual Studio and its features, but the thread is about Visual Studio Code. If you are referring to Visual Studio and not Code you probably want to open a ticket on the Visual Studio support forums. However, if you are referring to Visual Studio Code please help me understand how you have that menu in Code.

Thanks!

I'm referring to Rider, as clearly stated in my post :D "Rider has the same problem" - the feature exists, you can select a word and drag to select more words, you just can't assign it to any other function than double click drag. Sorry for the confusion!

@stevekm
Copy link

stevekm commented Mar 29, 2024

can we just re-open #137218 since this issue appears to have made no traction in 8 years? @Tyriar

I just want to be able to Paste in the Integrated Terminal with Middle Click :(

@Tyriar
Copy link
Member Author

Tyriar commented Mar 29, 2024

Everyone please stop pinging me, I get enough notifications already. I will not be the one implementing this; I requested the feature.

@ThaJay

This comment was marked as spam.

@psychicteeth
Copy link

@Tyriar Well, you are a member of this repo so more than most. @ironcladlou Perhaps? He seems to be a contributor here @be5invis Is a contributor too, as is @jhasse. Could @anchepiece be the right person? Or is it @sharwell, another member, or @bpasero? Later on, @Logerfo joined the party. @AndreasBackx is another real contributor, perhaps he could help? Or @ChayimFriedman2? @tjx666 got here in 2022. A bit more recent than the ones before.

I only joined this issue in 2023 so there's a lot I don't know.

It's clearly indicated to whom the issue is assigned. He's obviously busy with other work and usually on big projects is not the coders who assign themselves tasks but producers (maybe it's different in other software; I work in games).

Some acknowledgement of a timeline or some other kind of outlook from someone would be good, though.

@Tyriar
Copy link
Member Author

Tyriar commented Mar 29, 2024

@ThaJay keep doing that and our options are either blocking you or locking the issue.

@psychicteeth I don't have much insight into that unfortunately. I know it was looked at a year or 2 ago and I think it was harder than initially anticipated to do right.

@psychicteeth
Copy link

Thanks Daniel. I imagine if it were easy it would have been done already!

@alanhoyle
Copy link

I think you may want to consider trying "Copy on Selection" https://code.visualstudio.com/updates/v1_20#_copy-on-selection

so that simply highlighting text in the Integrated Terminal will automatically copy it

then you can Paste it with your choice of methods

Thanks for posting this. I was unaware of the setting and this has been annoying me for years.

@ANogin
Copy link

ANogin commented Apr 2, 2024

@Tyriar back in 2021 you closed #136633 stating

This has come up before and we decided not to go with it because of the extra complexity it brings mainly around settings clutter. The good news is this month we're looking into making mouse input customizable which this would fit with perfectly, let's reconsider after #3130, feel free to make an issue to track it.

With this one not moving, is it perhaps time to reopen that one and reconsider letting it in? Thank you!

@Tyriar
Copy link
Member Author

Tyriar commented Apr 2, 2024

@ANogin that's tracked in #187365 now, I agree this could still be a long way off so I'll have a look for the April release (v1.89).

@FantaZZ

This comment was marked as spam.

@MateenKhan
Copy link

👍

@DoCode
Copy link

DoCode commented Apr 22, 2024

In the meantime, you can use this AHKv2 script:

(Note: Works in Chrome and related editors, Notepad++, and also in Windows Terminal shells)

#Requires AutoHotkey v2.0

; Ctrl+Left Mouse button down send double-click to select the whole word under cursor (with enabled range selection)
#HotIf ((WinActive("ahk_class Notepad++") || WinActive("ahk_class Chrome_WidgetWin_1")) && A_Cursor == "IBeam") || WinActive("ahk_class CASCADIA_HOSTING_WINDOW_CLASS")
~^LButton::
{
    Send("{LButton Down}")
    Send("{Ctrl Down}")
}
#HotIf

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request Request for new features or functionality keybindings VS Code keybinding issues
Projects
None yet
Development

No branches or pull requests