Move a line up or down with VS Code

A quick tip on moving lines up or down a file using your keyboard in VS Code

You can rearrange the order of lines in your VS Code file by using the keyboard. This can be really handy if you want to manually re-order a list or hard-coded array.

Hold down Option / Alt and use the Up or Down arrow keys to move the currently selected line up or down.

You can also select multiple lines in VS Code and move them all at once.

This is something you won’t need every day, but is much faster than cutting and pasting when you do need it.

Recent posts View all

VS CodeWeb Dev

Select multiple lines in VS Code

How to select multiple lines to edit at once within VS Code

VS Code Web Dev

Move a line up or down with VS Code

A quick tip on moving lines up or down a file using your keyboard in VS Code