VSCode Shortcuts - SEIR-59/course-wiki GitHub Wiki

Awesome VS Code Shortcuts

Keyboard Symbols Name
⌘ command
βŒƒ control
βŒ₯ option/alt
⇧ shift

Overview of the VS Code Interface

PDF summary of all keyboard shortcuts

For MacOS

  • Note: all the shortcuts shown below are for macOS.

For Windows

For Linux

  • Note: Shortcuts can vary based on your current Linux distributon.

To edit the default shortcuts

  • Pull down menu: Code -> Preferences -> Keyboard Shortcuts

Launching from the command line

  • You can run VS Code from the terminal by typing code after adding it to your PATH.
  • To add code to the PATH, open the Command Palette (β‡§βŒ˜P) and type shell command to find the Shell Command: Install 'code' command in PATH command.

screenshot

  • Restart the terminal for the new $PATH value to take effect. You'll be able to type code . in any folder to start editing files in that folder or code filename.txt to open that file in VS Code.

Save Your File

  • ⌘S

Undo/Redo Typing

  • ⌘Z - undo typing
  • β‡§βŒ˜Z - redo typing

Increase/Decrease Font Size

  • ⌘+ - increase
  • ⌘- - decrease

Wrap text in Single Quotes, Double Quotes or Backticks

  • highlight the text you want to wrap in quotes
  • press ' or "
  • Note: you can use the same process to wrap text in parenthesis, curly braces, and square brackets!

Insert HTML boilerplate

  • start with a file that has an .html extension
  • type ! + tab

Find a Word in a File

  • ⌘F
  • Close by pressing esc

Find a Word in a Project

  • βŒ˜β‡§F
  • Close by pressing esc
  • You can open as many editors as you like side by side vertically and horizontally. If you already have one editor open, there are multiple ways of opening another editor to the side of the existing one:

  • ⌘\ to split the active editor into two.

  • Open to the Side (βŒƒEnter) from the Explorer context menu on a file.

  • Click the Split Editor button in the upper right of an editor. (it looks like a square split into two)

  • Drag and drop a file to any side of the editor region.

  • Ctrl+Enter (macOS: Cmd+Enter) in the Quick Open (⌘P) file list

Toggle Comments Multiple Lines at a Time

  • Highlight the code block you want to comment out, then ⌘/
  • Press ⌘/ again to uncomment the code.
  • Note: as long as you have saved your file with the proper extension: .html, .css, .js (etc.) the correct comment characters will be used for that language

screenshot

screenshot

Indent a Block of Code

  • highlight the block of code you want
  • ⌘] - Move code to the right (alternative tab)
  • ⌘[ - Move code to the left (alternative ⇧tab)

screenshot

screenshot

Move a block of Code

  • βŒ₯ Up (Up - up arrow)
  • βŒ₯ Down (Down - down arrow )

screenshot

screenshot

  • Note: some indentation may be lost in some cases

Replace Across Multiple lines

  • Highlight text to be replaced
  • ⌘D - to highlight next instance (as many as you'd like )
  • β‡§βŒ˜L - to highlight all isntances
  • Screenshot Highlight One Instance of Text

screenshot

  • Screenshot Highlight Subsequent Text `⌘D`

screenshot

  • Start Typing (See multiple blinking cursors)

screenshot

  • Click outside of selected area

screenshot

⚠️ **GitHub.com Fallback** ⚠️