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

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
/Down
on Windows
β
arrow - copy to upβ
arrow - copy to downWindows
Shift
+Option
+β
Shift
+Option
+β
Shift
+Option
+Up
/Down
on macOS
β
arrow - copy to upβ
arrow - copy to downmacOS
OS X
Ctrl
+Shift
+Alt
+β
Ctrl
+Shift
+Alt
+β
Ctrl
+Shift
+Alt
+Up
/Down
on 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
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:
