EN
VS Code - duplicate current line
7
points
In this short article, we would like to show how to duplicate / copy the current line in VS Code.
Quick solution:
Windows:
Shift+Alt+↓keysmacOS:
Shift+Option+↓keysUbuntu:
Ctrl+Shift+Alt+↓keys
Practical example
Simple steps:
- put caret to line that you want to copy,
- use one keys combination from the below table,
Depending on the operating system:Keys combination Description OS Shift+Alt+↑Shift+Alt+↓Shift+Alt+Up/Downon Windows
↑arrow - copy to up↓arrow - copy to down
Windows
Shift+Option+↑Shift+Option+↓Shift+Option+Up/Downon macOS
↑arrow - copy to up↓arrow - copy to down
macOS
OS X
Ctrl+Shift+Alt+↑Ctrl+Shift+Alt+↓Ctrl+Shift+Alt+Up/Downon Ubuntu
↑arrow - copy to up↓arrow - copy to downIt may be not working if some default configurations override keys.

Ubuntu
- 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:
- put caret to line that you want to copy,
- go to VS Code menu and use:
Selection -> Copy Line Up
or
Selection -> Copy Line Down - the line should be duplicated
Screenshot: