Languages
[Edit]
EN

VS Code - duplicate current line

7 points
Created by:
Aleena
334

In this short article, we would like to show how to duplicate / copy the current line in VS Code.

Quick solution (Shift+Alt+ keys used under Windows):

Shift+Alt+Down used to duplicate the current line under VS Code.
Shift+Alt+Down used to duplicate the current line under VS Code.

Simple steps:

  1. put caret to line that you want to copy,
  2. use one keys combination from the below table,
    Depending on the operating system:
     Keys combination DescriptionOS

     

    Shift+Alt+

    Shift+Alt+

     

    Shift+Alt+Up/Down

    on Windows

     arrow - copy to up

     arrow - copy to down

    Windows

     

    Shift+Option+

    Shift+Option+

     

    Shift+Option+Up/Down

    on Mac OS

    arrow - copy to up

    arrow - copy to down

    macOS

    OS X

     

    Ctrl+Shift+Alt+

    Ctrl+Shift+Alt+

     

    Ctrl+Shift+Alt+Up/Down

    on Ubuntu

    arrow - copy to up

    arrow - copy to down

     

    It may be not working if some default configurations override keys.

    Ubuntu

  3. the line should be duplicated

 

Using VS Code menu

It is possible to make a line copy from the options menu in VS Code.

Simple steps:

  1. put caret to line that you want to copy,
  2. go to VS Code menu and use:
    Selection -> Copy Line Up
    or
    Selection -> Copy Line Down
  3. the line should be duplicated

Screenshot:

Duplicate the current line in VS Code menu on Windows.
Duplicate the current line in VS Code menu on Windows.

Visual Studio Code

Native Advertising
🚀
Get your tech brand or product in front of software developers.
For more information Contact us
Dirask - we help you to
solve coding problems.
Ask question.

❤️💻 🙂

Join