Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How I can make `ctrl + click` to go to definition in visual studio code editor for mac OS?

How I can make ctrl + click to go to definition in visual studio code editor for mac OS? Now it is F12 which is using my mac for show desktop.

like image 472
Unnikrishnan Avatar asked Aug 29 '18 16:08

Unnikrishnan


People also ask

How I can make Ctrl Click to Go to definition in Visual Studio code?

Go to Definition# If a language supports it, you can go to the definition of a symbol by pressing F12. Tip: You can jump to the definition with Ctrl+Click or open the definition to the side with Ctrl+Alt+Click.

How do I enable Ctrl in VS Code?

go to File -> Preferences -> Keyboard shortcuts, or press Ctrl+K, then Ctrl+S, or edit %UserProfile%\AppData\Roaming\Code\User\keybindings.

How do I enable definition in Visual Studio?

Visual Studio Go To Definition The Go To Definition feature navigates to the source of a type or member and opens the result in a new tab. Using Keyboard, place your cursor on the member name and press F12. Using the mouse, right-click on the member name and select Go To Definition from the menu.


1 Answers

First and foremost, please note that in VS Code for macOS, the familiar Ctrl + click from Windows / Linux operating systems has been replaced with + click (i.e.: "command + click"). Try that first before proceeding any further as that shortcut should work out of the box without any special modifications.

However, if the above still doesn't work for you then try fixing the problem by editing your settings.json file. To do that, press F1, type settings json, then click Open Settings (JSON), and then do one of the following:

To use + click as your "Go to definition" shortcut, ensure the following line exists in your JSON settings:

"editor.multiCursorModifier": "alt", 

What this does is it explicitly sets VS Code's "add another cursor" shortcut to option + click (try it out for yourself!), thus freeing up + click to be used for the "Go to definition" operation.

Conversely, to use option + click as your "Go to definition" shortcut instead, add:

"editor.multiCursorModifier": "ctrlCmd", 

Note: the above line will actually set the "add another cursor" shortcut to + click (not Ctrl + + click, as implied by the JSON value).

like image 195
cactuschibre Avatar answered Sep 20 '22 03:09

cactuschibre