Skip to main content

Multiple cursors in vscode

Need to edit multiple lines in VSCode where search/replace fails? Learn the powerful Multiple Cursors feature and the quick keyboard shortcut to make bulk edits instantly.

· 3 min read
View raw
Christophe
Markdown, WSL and Docker lover ~ Insatiable curious.
Cet article existe aussi en français — lire la version française.

This article is over a year old but was reviewed on July 30, 2026 — the content is still accurate.

Multiple cursors in vscode

⚡
TL;DR

This article shows VSCode's Multiple Cursors feature for bulk-editing many lines at once (e.g. turning a block of lines into a bullet list) when search-and-replace can't do the job: select the lines, press Shift+Alt+I to place a cursor on each, then edit them all simultaneously with Home/End/Ctrl+Right navigation.

One of the best features in VSCode is the Multiple cursors one.

Imagine you have a bunch of lines where you need, for instance, to remove the first two characters. Each line starts with // and you want to remove just that prefix, not any // that might appear elsewhere in the line (a search & replace can't be used for that).

Or, for another example, you must enclose each line in double brackets.

With VSCode, it's ultra-simple: multiple cursors.

Multiple cursors shine for one-off, irregular edits. When the change is a repeatable rule applied to a whole file, Search and replace (or add) using sed is the better tool.

Imagine the lines below and you need to add * before each line to make a list of items. In this example, I only have six lines so yeah, it's possible to do it manually, one by one. Imagine you had a hundred or a thousand.

Lorem ipsum dolor sit amet, consectetur adipiscing elit.
Vestibulum ut purus nec dui tincidunt consequat.
Aliquam ac orci vel tellus posuere auctor.
Vestibulum auctor lacus eget sagittis laoreet.
Phasellus eleifend nulla blandit arcu tempor, sed posuere elit efficitur.
Donec blandit erat non placerat cursus.

That's the result — every line turned into a bullet point in one shot:

Multiple cursors

Here is how to do it:

  • Select all the lines you need to update,
  • Press SHIFT-ALT-I to enable multiple cursors,
  • Press Home to put cursors at the beginning of each line,
  • Press * followed by a space to transform the list of lines to a bullet list.
  • Press ESC to quit the multiple cursors mode.

While the multiple cursor mode is enabled, you can also press END to go to the end of lines, add/remove f.i. a character, you can press CTRL-RIGHT to move from one word right and so on.

Pretty cool option.

VSCode is full of these built-in features you only discover by accident. Two others I use every day: sticky scroll, to always know which function or heading you're inside of, and autosave, to stop pressing CTRL+S altogether.


Was this article helpful?
Did you try the steps in this article?