Skip to content

Instantly share code, notes, and snippets.

Last active May 3, 2023 13:57
Show Gist options
  • Save ryaustin/937042e5a5866e9b3ccb5ef0ea22eb22 to your computer and use it in GitHub Desktop.
Save ryaustin/937042e5a5866e9b3ccb5ef0ea22eb22 to your computer and use it in GitHub Desktop.
Visual Studio Code shortcuts for the productive developer.
**VS CODE Productivity Shortcuts** πŸ‘©β€πŸ’»πŸ§‘πŸ½β€πŸ’»πŸ‘¨πŸΌβ€πŸ’»πŸ‘©πŸΌβ€πŸ’»πŸ‘©πŸΎβ€πŸ’»
A kind note: I haven't tested these on windows, if you notice an error, drop it in the comments :).
1. Opening and closing sidebar πŸ“‚
The sidebar can be opened and closed without clicking on the left-hand side tab using the following shortcuts.
Mac β€” Command + B
Windows β€” Ctrl + B
2. Select word ‡️
I use this one to select the word at my cursers current position. This is useful when you want to change the name of a variable or function.
You can also highlight the word and continue to use the shortcut to highlight the next instance of the word.
Mac β€” Command + D
Windows β€” Ctrl + D
3. Split Editor πŸ––
A split editor (side by side) is often useful if you need to compare two files or refer to another file while making changes to a different file
Mac β€” Command + \ or 2,3,4
Windows β€” Shift + Alt + \ or 2,3,4
3b. Close Window πŸͺŸ
Mac β€” Command + w
Windows β€” Ctrl + w
4. Copy line up/down Β©
If you need to copy the current line to the line above or below, the following shortcut can be used.
Mac β€” Shift + Option + Up/Down
Windows β€” Shift + Alt + Up/Down
5. Code formatting πŸ’πŸ½β€β™€οΈ
Code formatting allows indenting the code based on the rules already set up in the editor.
Windows β€” Shift + Alt + F
Mac β€” Shift + Option + F
6. Command Palette πŸ¦Έβ€β™‚οΈ
This is one of the most important key combinations to know in VS Code. You can access all available commands based on your current context using:
MAC β€” Command + Shift + P
Windows/Ubuntu: Ctrl +Shift + P
6b. Some cool command Palette shortcuts πŸ¦ΉπŸ½β€β™‚οΈ
> - Right angle bracket exposes all the command palette shortcuts and just about anything that can be done in vs code.
: - go to a specific line in your code after typing a colon in the command palette.
@ - @ symbol exposes all of the symbols in the file. Think of this like an automatic outline that allows you to jump to any function/method quickly. A shortcut to expose just this tool is:
MAC β€” Command + Shift + .
Windows β€” Ctrl + Shirt + .
7. Move line ⬇️
Mac β€” Option + Up/Down arrow
Windows/Ubuntu β€” Alt + Up/Down arrow
8. Delete a line ❌
Mac -- Command + Shift + K
Windows -- Ctrl + Shift + K
9. Duplicate line πŸ”„
You can make the duplications of the same line using:
Mac β€” Command + Shift + D
Windows/Ubuntu β€” Ctrl + Shift + D
10. Open / Close Terminal πŸ‘©πŸΎβ€πŸ’»
Quickly open and close a terminal using:
Mac -- Comand + j
Windows -- Ctrl + j
11. Split Terminal δ·–
Splitting a terminal can be done using:
Mac -- Command + /
Windows -- Ctrl + /
hint: when working with a virtual environment, splitting a terminal will often open in the context of your virtual env which is sweet 😍
12. Stage Selected Ranges πŸŽͺ
If you tend to stage changes line by line you can do so by using:
Under source control highlight the lines to commit then,
Mac -- Command + K to mark the line then Command + Option + S to stage
Windows -- Control + K to mark the line then Control + Alt + S to stage
13. Jump to a spceific line __
Mac -- Control + G
Windows __ Ctrl + G
14. Return to previous place (after a jump) ⏎
After jumping to a spcific line or function, you can return to the previous place using:
Mac -- Control + -
Windows -- Ctrl + -
15. SORT YO SYMBOLS (Sort Symbols) 😱🀩🀯
Sorry for being loud on this one but it's a huge help when working
in a larger code base.
Mac -- Cmd + Shift + o then press : and you can search or sort by an array of factors.
Windows -- Ctrl + Shift + o
This one is a game changer for me, hope you find it useful.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment