Select multiple lines in VS Code

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

If you want to make edits to multiple places in a file and Find and Replace isn’t an option, you might want to make use of VS Code’s ability to select multiple locations at once.

By holding down the Option / Alt key you can use the mouse cursor to select different places you want to set a cursor to. You will notice that multiple cursors appear on screen at once and will respond to keyboard commands, so using the arrow keys will move all cursors in the same direction etc.

A screenshot of this post in a text editor showing two text cursors, one after the word Screen and one after the word Direction.
An example from this very post

If all your edits are happening in the same column of text, but across multiple lines, you can also hold Command + Option / Alt and use the Up or Down keys to add a new text cursor above or below where you are.

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