Passella
Passella

Reputation: 709

What is the keyboard shortcut for CTRL + CLICK in Visual Code?

What is the shortcut key to Ctrl+Click (Follow Link) in Visual Code? If it doesn't have one, is there any way to add it?

enter image description here

In Eclipse, if I press F3 I can open the file, like Ctrl+Click

Upvotes: 23

Views: 18549

Answers (2)

axiac
axiac

Reputation: 72196

In HTML files the command is "Open Link" (editor.action.openLink). This command does not have, by default, associated a key combination. You can assign one by using the Preferences -> Keyboard Shortcuts command from the menu (click on the gear on the bottom of the primary side bar).

In other contexts (source code in various programming languages), the combination Ctrl+click (or Cmd+click on macOS) when the cursor is on an identifier (constant name, variable name, function name, class name, etc.) is equivalent with command "Go to Definition" (editor.action.revealDefinition). This command has, by default, associated the key F12.

Upvotes: 36

Denis Howe
Denis Howe

Reputation: 2411

Do Command/Control P > keybindings.json and insert:

[
    ...,
    {
        "key": "ctrl+f12",
        "command": "editor.action.openLink"
    }
]

to set Ctrl F12 to open the link under the cursor.

Upvotes: 3

Related Questions