How to disable Ctrl-Click in VS Code
Asked Answered
G

4

30

I want to know if it's possible to remove the key bind on Ctrl-Click for the goToDefinition (F12) editor action.

This is so annoying, every time i try to Ctrl+C/V it trigger and go to the definition cause I'm holding Ctrl while I'm highlighting the code with my mouse.

I have search for it on google but all y can change is the F12 key bind for goToDefinition which is not what I want.

--- Update

This is the feature I want to disable

enter image description here

I need to remove the ctrl+click key bind. Even if I replace it, it doesn't work.

-- Update 2

I finally found something on the subject Here

But for me it doesn't work at all.

-- Update 3

Created a new issue on GitHub (#7827) Look at it if you wanna see the update on the request.

Grimmett answered 7/6, 2016 at 15:37 Comment(4)
For fellow searchers, the Github issue was closed as it was specific to this copy-paste bug. The overaching feature of disabling Ctrl-Click is at: github.com/Microsoft/vscode/issues/23957 and has not been fixed at time of writing.Phlegethon
Agreed. github.com/microsoft/vscode/issues/23957 offers comments explaining best alternative temporary workaround for the time being (Selection -> Switch to Ctrl Click for Multi Cursor)Pansir
To be honest, until about 2 years'ish (give or take a couple months) I liked JetBrains WebStorm, IntelliJ, and CLion, as my Dev Env's of choice. Today, I use V.S. Code for almost everything, as it gives me control and access to a broad range of technologies & features without having to use multiple different IDE's. It has the most modern features of any IDE or Editor, Its the Jack knife of Dev Env, however, JetBrains still to this day, does somethings that VS Code hasn't implemented yet, one being Mouse click keybindings.Nablus
Does anyone know how to ctrl click into a vue component and have it actually take you to that file rather than just show definition?Lemuelah
D
7

At the time of writing (2022) you can turn off this with workaround by setting following setting to 'ctrlCmd'.

enter image description here

How to open setting page in vs code?

Ctrl+Shift+P and enter open setting (UI) enter image description here

Downcome answered 19/5, 2022 at 12:45 Comment(2)
more details on this solution can be found here: code.visualstudio.com/docs/editor/codebasicsDivers
After an update rendered the default "go to definition" key binding not working, changing this setting to alt did the trick. Thank!Aiello
P
3

There is a VS Code feature request for this on GitHub, under the more general heading Allow customization of mouse shortcuts.

Anyone interested in this VS Code feature should comment/vote there. (The Ctrl-click-specific GitHub posts have been closed off and linked to this one. Ex. #16974)

Pharyngeal answered 21/7, 2020 at 10:50 Comment(0)
S
0

Fastest way:

  1. Press F1 (opens search bar).
  2. Search multi-cursor modifier
  3. Just press the toggle appearing as the search result.

enter image description here

Sustainer answered 11/5, 2023 at 10:58 Comment(0)
O
-2

Add the following lines in keybingings.json to disable (actually override default behaviour) mouse+ click

[
    { "key": "ctrl+[mouse button]",   "command": "cursorWordLeft",
                                         "when": "editorTextFocus" }
]

To open key bindings file, traverse

File > Preferences > Keyboard Shortcuts

enter image description here

Openhearth answered 8/6, 2016 at 3:28 Comment(5)
maybe i do it wrong.. Should i change [mouse button] by left or right ?? cause when i write the exact same thing as you it doesnt work :/Grimmett
Already tried and it doesn't work like i said. When i ctrl+mouseUp/Down it go to def... I have updated my original post with more details @PandiyanCoolGrimmett
ATM VS Code has no support to configure the mouse behaviour. This answer is not correctEducationist
This answer used to work for me but no longer works. VSCode must have removed this feature =/Fogged
Someone downvoting this answer after 4 years. :) VSCode itself might have dropped that feature. :)Openhearth

© 2022 - 2024 — McMap. All rights reserved.