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

Web DevProductivity

Keeping on top of website updates

Learn what website updates are, what they entail, why they are important, and how we can help

Freelancing

Getting the most out of your agency

Here are some tips based on years of working with, for, and as an agency on how to get the most out of any work you do.