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

SEO

Google follows URLs in text

Today I learned that Google follows URLs even when they are plain text

Web Dev

Check in with your database

It pays to take a step back and look at how your database is set up every so often. You will often find quick wins and hidden tech debt.