1. Find a File
Cmd + P : Quickly search for a specific file in the current workspace. This one works really well in conjunction when opening and using the split editor.
2. Find in current File
Cmd + F : Instantly find whatever you’re looking for in the current file you’re in. Pressing Alt at the same time will open the Find & Replace, and pressing Enter will move your cursor to the next occurrence of the current search.
3. Global Find
Shift + Cmd + F : Also similar to Toggle Sidebar, but this one works for the Global Find sidebar panel.
4. Toggle Panel
Cmd + J : Quick show and hide the bottom panel, this includes the Terminal, Output, Problems, and Debug Console.
5. Toggle Sidebar
Cmd + B : Straightford, quickly show and hide the sidebar.
6. Focus Debugger
Shift + Cmd + D : Another Toggle Sidebar, except this one is for the Debugger sidebar. By default, VSCode binds most of the top-keyboard function keys to Debugger actions (e.g.: F5 to start, Shift + F5 to stop, F9 to create a breakpoint), but I highly recommend changing these, as the function keys can be awkward to reach sometimes.
7. Focus/Split Editor
Cmd + [1-9] and Cmd + \ : Using Cmd with any number will focus on that specific editor number. For example: Cmd + 2 will focus on the second editor, and if that specific editor window isn’t open, it will open an empty editor for you. If you want to split the current file into a second editor window, that’s what Cmd + \ does.
8. Focus Git
Shift + Ctrl+ G : And one more Toggle Sidebar, but this one is for Git. When you focus the Git sidebar, VSCode will put your cursor into the commit message field, so you can quickly commit any changes you have staged using Cmd + Enter. (By default, VSCode doesn’t have a shortcut to stage changes, I have mine bound to Shift + Cmd + A to Stage All Changes, and Shift + Cmd + S changed to Stage Current File).
9.Open Command Palette
Shift + Cmd + P : The command palette will quickly become your best friend as you learn various shortcuts. If you ever forget a shortcut, simply open the command palette, and search for what you’re trying to do.
10. Copy current line up or down
Shift + Opt + Up / Shift + Opt + Down : it will copy lines up or down.
11.Move current line up or down
Opt + Up / Opt + Down : Easily move the line that the cursor is currently at up or down. This also works if multiple lines are selected as well.
12. Comment Selection
Cmd + / : Straightford, will comment out either the current selection or the line the cursor is currently on. This also works in reverse, in that it will also uncomment as well.
13. Close Current Editor
Cmd + W : Closes the current editor that is currently focused. If you have the workbench.editor.closeEmptyGroups setting turned off, VSCode will leave an empty editor open for you (which Cmd + W will also close).
14. Show Suggestion
Ctrl + Space : Forcing Intellisense to open can come in really useful, especially when trying to find specific settings while editing settings.json.
Once you start to make an effort to learn the various shortcuts provided by VSCode, you’ll quickly realize just how much of your workflow can be easily achieved using a couple of key taps. It’s not to say that you’ll completely stop using your mouse altogether although that is totally an option using the Vim extension, but that now you’ll no longer be so reliant on using it anymore.
If you’d like a more complete reference/cheatsheet for all of the common VSCode shortcuts, check out the official guide!
Good luck, and happy coding!
Top comments (4)
Thanks for
shift + command + p
.I used F1 for that in Windows but I recently started to work in macOS(function keys in the toolbar, it's very uncomfortable).
I didn't know the command so I used
command + p
and typing ' > ' fast then 😂.My Pleasure
I use the find, Command Palette and commenting the most.
yes it totally depends on the developer choice what shorcut he wants to use