Reorder or duplicate VS Code lines without a cut-and-paste detour
Option-Up/Down moves a line; Shift-Option-Up/Down copies it. Adding Shift changes the result from relocation to duplication.
- Scope
- Visual Studio Code · Current vendor documentation checked 3 November 2026; no running-app compatibility test is claimed.
- Keyboard and customization
- Documented Mac defaults; punctuation and function keys depend on keyboard layout and hardware.. User bindings, app versions, focused controls and installed extensions can change a command. Inspect the active app menu or its shortcut editor when a listed combination differs.
- Review basis
- Documentation reviewed 2026-11-03 by Codex — primary-documentation and editorial review; no hands-on runtime test. These bindings were not tested in a running app for this guide.
Choose move or copy before pressing the arrow
Moving is useful when a statement or paragraph belongs above or below its neighbour. Copying is useful when you want a starting point for another similar line. Those intentions differ: a duplicated statement can have unintended effects in code, so look at the result before making another edit.
Inspect the selection and surrounding structure
A selection can make the action apply to several lines. Confirm indentation, comments and syntax after the movement rather than judging success only by the cursor position. Language formatting and the meaning of a code block can require more review than a simple visual reorder of text.
Use a reversible example
Create a disposable three-line note, move the middle line and then try the copy variant. Undo the changes after observing the difference. This is a safe way to learn the extra Shift modifier before using the commands on executable code or a file where repeated lines have a significant meaning.
Documented commands for this workflow
Scroll the table sideways to see every column.
| Action | Keys | When to use it |
|---|---|---|
| Move a line upward | Option-Up Arrow | Can act on the selected lines rather than only one line. ↗ |
| Move a line downward | Option-Down Arrow | Inspect the surrounding structure after moving. ↗ |
| Copy a line upward or downward | Shift-Option-Up Arrow / Shift-Option-Down Arrow | Produces another line instead of simply relocating the original. ↗ |
Sources and corrections
- Default keyboard shortcuts — Visual Studio Code — checked 2026-11-03
- Basic editing — Visual Studio Code — checked 2026-11-03
Found a mismatch? Email pashaseenainc@gmail.com with your app version, macOS version, keyboard layout and the command. Please leave personal document names out.
Keep going
Right there when you need it.
Keep a compact shortcut reference in your Mac’s menu bar.
Explore the native Mac app