Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use VSCode keyboard shortcuts with a Mac?

I'm running VSCode for Golang development on my Macbook. If I right click on a method I can "Go To Definition", but it also says that I can use the keyboard shortcut of F12 to accomplish the same thing. The problem is that there is no F12 key on my macbook. I have an external keyboard that appears to be trying to double use the "Increase volume" button as a F12 key, but even when I try using that it doesn't work.

What is the proper keyboard shortcut for "Go To Definition" (or any shortcut that uses the function keys) when you are using a Mac?

like image 483
Abe Miessler Avatar asked Jun 26 '19 23:06

Abe Miessler


People also ask

How do I change shortcuts in VS Code Mac?

Advanced customization To configure keyboard shortcuts through the JSON file, open Keyboard Shortcuts editor and select the Open Keyboard Shortcuts (JSON) button on the right of the editor title bar. This will open your keybindings.json file where you can overwrite the Default Keyboard Shortcuts.

How do I navigate code in VS Code Mac?

Hold Ctrl and press Tab to view a list of all files open in an editor group. To open one of these files, use Tab again to pick the file you want to navigate to, then release Ctrl to open it. Alternatively, you can use Ctrl+Alt+- and Ctrl+Shift+- to navigate between files and edit locations.

How do I use VS Code shortcuts?

You can define a keyboard shortcut for any task. From the Command Palette (Ctrl+Shift+P), select Preferences: Open Keyboard Shortcuts File, bind the desired shortcut to the workbench.action.tasks.runTask command, and define the Task as args .

How do I enable keyboard shortcuts in Visual Studio?

On the menu bar, choose Tools > Options. Expand Environment, and then choose Keyboard.


2 Answers

A few options:

  • Hold the fn key and then press f12 (if your keyboard has an fn key)

  • Change the VS Code keybinding

  • Change your mac to use normal function keys: System Preferences -> Keyboard -> Use F1, F2, etc. as standard function keys

like image 72
Matt Bierner Avatar answered Nov 29 '22 02:11

Matt Bierner


refer to the below Visual Studio Code URL https://code.visualstudio.com/docs/editor/editingevolved#_go-to-definition

For Macbook

Press COMMAND (i.e. ⌘) symbol and hover over a symbol for the preview of the definition.

You can also jump to the definition by with COMMAND button (i.e. ⌘) + Click or press COMMAND + OPTION + Click to open the definition to the side.

like image 26
Manish R Warang Avatar answered Nov 29 '22 04:11

Manish R Warang