Languages
[Edit]
EN

VS Code - duplicate current line

7 points
Created by:
Aleena
694

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

Quick solution:

Windows: Shift+Alt+ keys

macOS: Shift+Option+ keys

Ubuntu: Ctrl+Shift+Alt+ keys

 

Practical example

Keys combination used to duplicate the current line under VS Code.
Keys combination 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 macOS

    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.

Alternative titles

  1. VS Code - copy current line
  2. VSCode - duplicate current line
  3. VSCode - copy current line
Donate to Dirask
Our content is created by volunteers - like Wikipedia. If you think, the things we do are good, donate us. Thanks!
Join to our subscribers to be up to date with content, news and offers.

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