Visual Studio Code Keyboard Shortcuts

Working with lines in VSCode – Copy, Join, Delete, Dublicate lines VSCode

About Visual Studio Code

I coded many years in my favorite Notepad++, but at some point, you understand the necessity of a proper code editor. Debugging, git, project structure, and many other things needed for programming are available only in the IDE (Integrated Development Environment).

Altought VSCode ( Visual Studio Code) is code editor, but it is closest to IDE you can get for free. VSCode is very feature rich, excellent for larger and more complex than 1-page site projects. It has built-in git support, debug, terminal and other useful functions for coding.

However, everything has its own price. Visual Studio Code has as many hotkeys as features, even much more than that. For a beginner, it is super easy to miss half of the keyboard shortcuts, even with VSCode suggestions turned on.

Visual Studio Code Keyboard Shortcuts for Lines

Usually, people know how to work with characters and words – select, copy-paste, delete. But when you code, the ability to work with lines can speed up your work a lot. Learn how to duplicate lines, delete, and so on in this small guide:

How to Duplicate lines in VSCode

To duplicate line in Visual Studi Code, please use this combination:

  • On Windows: Ctrl + Shift + D
  • On Mac: Command ⌘ + Shift + D
  • On Linux: Ctrl + Shift + D

How to Join lines in VSCode

To join lines in Visual Studi Code, please use this combination:

  • On Windows: Ctrl + J
  • On Mac: Command ⌘ +J / Ctrl + J
  • On Linux: Ctrl + J / Ctrl + Del

How to Delete lines in VSCode

To delete lines in Visual Studi Code, please use this combination:

  • On Windows: Ctrl + X
  • On Mac: Command ⌘ + X
  • On Linux: Ctrl + X

How to Copy line Up or Down in VSCode

To copy line UP or Down in Visual Studi Code, please use this combination:

  • On Windows: Shift + Alt + Up/Down
  • On Mac: Shift + Option ⌥ + Up/Down
  • On Linux: Ctrl + Shift + Alt + Up/Down

A Keyboard shortcut for VSCode doesn't work

If any of the command doesn't work ( due to the newer version of the software), please check out Preferences > Keyboard Shortcuts, you will find all actual hotkeys there.

Also, you can  overwrite  existing keyboard shortcuts by providing a different key combination for the command editor.action.joinLines in keybindings.json.

Another option is to Open keyboard shortcuts from File > Preferences > Keyboard shortcuts, and bind editor.action.joinLines

 

Thank you for reading!

Related posts

Leave a Comment

Your email address will not be published. Required fields are marked *