Copy Line Up / Down
What is Copy Line Up / Down?
Copy Line Up / Down: Duplicate the current line above or below the original. Copy line up or down duplicates the current line, or the selected lines, directly above or below. In VS Code it is Shift+Alt+Up/Down on Windows and Linux, or Shift+Option+Up/Down on a Mac. JetBrains IDEs use Ctrl+D or Cmd+D. It is faster than select, copy and paste, and it does not touch your clipboard. That is handy when you are building a list of similar entries, such as routes, array items or test cases, and only need to change one value in each copy.
Frequently asked questions about Copy Line Up / Down
What should you keep in mind with Copy Line Up / Down?
Its sibling, move line up or down, uses Alt+Up/Down in VS Code and shifts lines without duplicating them. Together they cover most of the small reshuffling you do while writing code. If you catch yourself copying the same line three times, a loop or a data structure may be the better solution.
At a glance
| Category | Keyboard shortcuts |
|---|---|
| Explained by | Reinier de la Parra |
| Updated |