VSCode
find file
Ctrl+P (Cmd+P on Mac)
Ctrl + Tab : switch between opened files
⌃-
and ⌃⇧-
: navigate between files and edit locations.
Go to Definition
If a language supports it, you can go to the definition of a symbol by pressing F12
.
If you press Ctrl
and hover over a symbol, a preview of the declaration will appear.
You can jump to the definition with Ctrl+Click
or open the definition to the side with Ctrl+Alt+Click
.
Go to References
Shift + F12
Peek Definition
Alt+F12
You can navigate between different references in the peeked editor and make quick edits right there. Clicking on the peeked editor filename or double-clicking in the result list will open the reference in the outer editor.
Additionally, the peek window is closed if you press Escape or double-click in the peek editor region.
Go to Symbol in File
- On Windows/Ubuntu: Ctrl + Shift + o
- On Mac: Command + Shift+ o
You can group the symbols by kind by adding a colon, @:
.
Go to Symbol in Workspace
- On Windows/Ubuntu: Ctrl + t
- On Mac: Command + t
Navigate to a Specific Line
- On Windows/Ubuntu: Ctrl + g
- On Mac: Ctrl + g or Ctrl + p
delete line
On Windows/Ubuntu: Ctrl + x On Mac: Command + x or Cmd+Shift+k
Delete Previous Word
- On Windows/Ubuntu: Ctrl + backspace
- On Mac: Command + delete
join lines
- On Mac: Ctrl+J
- On Ubuntu, Windows: Open keyboard shortcuts from File > Preferences > Keyboard shortcuts, and bind editor.action.joinLines to a shortcut of your choice.
Copy Line Up/Down
- On Windows: Shift + Alt + Up/Down
- On Mac: Shift + Option + Up/Down
- On Ubuntu: Ctrl + Shift + Alt + Up/Down
Select in Words
- On Windows/Ubuntu: Ctrl + Shift + Right arrow / Left arrow
- On Mac: Command + Shift + Right arrow / Left arrow
This is very useful to select words faster and edit as required.
Add Cursor Above/Below
- On Windows / Ubuntu: Ctrl + Alt + Up arrow / Down arrow
- On Mac: Command + Alt + Up arrow / Down arrow
You can select blocks of text by using the above command while you drag your mouse. A separate cursor will be added to the end of each selected line.
Select Word
- On Windows: Ctrl+ d
- On Mac: Command + d
- On Ubuntu: Ctrl+ d
If you hit command + d more than once, you’ll add another occurrence of the same keyword to your selection.
Column (Box) Selection
- On Windows / Ubuntu: Shift + Alt
- On Mac: Shift + Option
You can select blocks of text by using the above command while you drag your mouse. A separate cursor will be added to the end of each selected line.
Code Formatting
This shortcut helps to indent the code as already set up in the editor settings.
Tip: Use this in the end or the start. I prefer using it when I’m done with the code in a file.
- On Windows: Shift + Alt + F
- On Mac: Shift + Option + F
- On Ubuntu: Ctrl + Shift + I
Opening and Closing the Sidebar
- On Windows/Ubuntu: Ctrl+ b
- On Mac: Command + b Sometimes when the file has a long width or in case of the split editor closing, sidebar helps a lot.
https://code.visualstudio.com/docs/introvideos/basics
https://code.visualstudio.com/docs/editor/editingevolved
https://betterprogramming.pub/20-vs-code-shortcuts-for-fast-coding-cheatsheet-10b0e72fd5d