shortcutsguide

Duplicate Line Shortcut (⇧⌥↓ / Shift+Alt+↓)

Copy the current line without selecting it: press Shift+Alt+↓ on Windows or ⇧⌥↓ on Mac in VS Code. Here it is next to Sublime Text and JetBrains.

ActionMacWindows
Duplicate line down (VS Code) ⇧⌥↓ Shift+Alt+↓
Duplicate line up (VS Code) ⇧⌥↑ Shift+Alt+↑
Duplicate line (Sublime Text) ⌘⇧D Ctrl+Shift+D
Duplicate line (JetBrains / IntelliJ) ⌘D Ctrl+D
Copy whole line (no selection) ⌘C Ctrl+C

Duplicate a line in one keystroke

In VS Code, put the cursor anywhere on a line and press Shift+Alt+↓ (Windows/Linux) or ⇧⌥↓ (Mac) to copy that line to the line below. Use ↑ instead of ↓ to place the copy above. No text selection is needed — the whole line is duplicated.

Other editors

Sublime Text: Ctrl+Shift+D / ⌘⇧D. JetBrains (IntelliJ, PyCharm, WebStorm): Ctrl+D / ⌘D. If several lines are selected, every editor duplicates the whole block.

Troubleshooting: nothing happens

If Shift+Alt+↓ does nothing in VS Code, the shortcut is often grabbed by the OS or a graphics driver (Alt+arrow rotates the screen on some Windows/Intel setups). Disable screen-rotation hotkeys, or rebind the command Copy Line Down in File → Preferences → Keyboard Shortcuts. On Mac, check that Mission Control isn't using ⌥↓.

More code-editor shortcuts: comment out a line or jump to a line number.

FAQ

How do I duplicate a line in VS Code?

Press Shift+Alt+↓ (Windows/Linux) or ⇧⌥↓ (Mac) to copy the current line below it; use ↑ to copy it above. No selection needed.

What is the duplicate line shortcut in Sublime Text?

Ctrl+Shift+D on Windows/Linux, ⌘⇧D on Mac.

How do I duplicate a line in IntelliJ / JetBrains IDEs?

Ctrl+D on Windows/Linux, ⌘D on Mac duplicates the current line or selection.

Why does Shift+Alt+↓ not work on Windows?

Alt+arrow is sometimes reserved by the Intel graphics driver to rotate the screen. Disable the rotation hotkeys in the graphics control panel, or rebind 'Copy Line Down' in VS Code's keyboard shortcuts.