The shortcut in VS code

When it comes to programming, there’s a lot of pro tips to do it efficiently. I would say key board shortcuts is one of them, and people, including me. overlock its power.

Once you get used to those shortcuts, your efficiency of development is much better, which could lead you to express your thoughts to code without time gap.

Mac keyboard shortcuts.

  1. Command-X: Cut the selected item and copy it.

2. Command-C: Copy the selected item to the Clipboard. This also works for files in the Finder.

3. Command-V: Paste the contents of the Clipboard into the current document or app.

4. Command-Z: Undo the previous command. You can then press Shift-Command-Z to Redo, reversing the undo command.

5. Control–Command–Space bar: Show the Character Viewer, from which you can choose emoji and other symbols.

6. Control-Command-F: Use the app in full screen.

7. Command-Tab: Switch to the next most recently used app among your open apps. I usually use it the most in all shortcuts.

8. Shift-Command-3: Take a screenshot of the entire screen.

9. Command–Left Curly Bracket ({): Left align.

10. Command–Right Curly Bracket (}): Right align

And here is the lists I use much when programming, so I can move the cursol only by keyboard.

  • Control-A: Move to the beginning of the line or paragraph.
  • Control-E: Move to the end of a line or paragraph.
  • Control-F: Move one character forward.
  • Control-B: Move one character backward.
  • Control-L: Center the cursor or selection in the visible area.
  • Control-P: Move up one line.
  • Control-N: Move down one line.
  • Option-Delete: Delete the word to the left of the insertion point.

These are default shortcuts in VS code.

The most important one is,

Shift-Command-P: Open command Pallete, you can also do the same thing in F1.

The command pallete shows us anything. When you wanna do some shortcuts but forget to do that, just open the command pallete.

  1. Command-P: Go to file.
  2. Command-Comma: Open user settings. If you wanna change the default settings in vscode, like linting code, you may open this setting.
  3. Shift-Command-K: Delete current line
  4. Option-Command-StartSquareBracket: Fold the current code, unfold is option-command-endSquareBracket.
  5. Command-slash: Toggle comment
  6. Command-I: Select current line
  7. Option-Command-F: Replace some word with the new one.
  8. Shift-Option-F: Format
  9. F2: Rename symbol. It works similar to replace. Even though, sometimes it doesn’t work as expected.
  10. Option-Command-S: Save all open file, one file is done in Command-S.
  11. Control-Tab: Open next file, which is currently open in tab.
  12. F5: Start debugging, before do that, you might make laugnch.json to run debug in the right file you debug.

Those are the common shortcuts in VS code.

Note that it is only available in Mac with Vs code. If you do with Windows OS, the things change at all.

The thing is Open Pallete(Shift-Command-P) is always our friend.