# Edit Multiple Lines Simultaneously with Visual Studio Code

> Ever find yourself needing to make the same edits to consecutive lines in VS Code? Learn about multi-line editing!

- URL: https://blog.nimblepros.com/blogs/edit-multiple-lines-simultaneously-with-visual-studio-code/
- Author: [Sarah Dutkiewicz](https://blog.nimblepros.com/authors/sadukie/)
- Published: 2024-06-13
- Categories: [Tools](https://blog.nimblepros.com/categories/tools/)
- Publisher: [NimblePros](https://blog.nimblepros.com/)

---

Have you ever had a moment where you need to make the same edits to multiple lines in a file? Maybe you have a list that needs bullets added at the beginning and don't want to add the bullets individually? I recently had a case where I needed to bold the concepts appearing in [my Clean Architecture course](https://academy.nimblepros.com/p/intro-to-clean-architecture) and didn't want to deal with each change individually. I used to use Notepad++ long ago to do multi-line editing, and I was curious whether I could do it in Visual Studio Code. It turns out - I can!

## Steps for Multi-Line Editing in Visual Studio Code

1. Set the cursor in the first line you want to edit.
2. Generate multiple cursors:
  - On Windows, use `Ctrl+Alt+Down` or `Ctrl+Alt+Up` to insert more cursors on consecutive lines. Use `Alt+Click` to add cursors to separate lines, not necessarily consecutive.
  - On Linux, use `Shift+Alt+Down` or `Shift+Alt+Up` to insert more cursors on consecutive lines. Use `Alt+Click` to add cursors to separate lines, not necessarily consecutive.
  - On Mac, use `⌥+⌘+Down` or `⌥+⌘+Up` to insert more cursors on consecutive lines. Use `⌥+Click` to add cursors to separate lines, not necessarily consecutive.
3. Make your edits!

In my case, I wanted to add bold Markdown to my words. So I took the following steps:

1. Start at the beginning of the word.
2. Add the `**` to start the bold.
3. Use `Ctrl + right-arrow` to move to the end of the word. Notice that it moved the cursor to the end of each word.
4. Add the `**` to end the bold.

You can see this tip in action here: 

<iframe width="320" height="560"
src="https://www.youtube.com/embed/bSko0uBdNNE"
title="YouTube video player"
frameborder="0"
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"
allowfullscreen></iframe>

## Resources

These are some of the resources I use when working with edits and keyboard shortcuts in Visual Studio Code:

- [Official documentation on Multiple selections in Visual Studio Code](https://code.visualstudio.com/docs/editor/codebasics#_multiple-selections-multicursor)
- [Microsoft's Visual Studio Code Keyboard Shortcuts for Windows](https://code.visualstudio.com/shortcuts/keyboard-shortcuts-windows.pdf)
- [Microsoft's Visual Studio Code Keyboard Shortcuts for Linux](https://code.visualstudio.com/shortcuts/keyboard-shortcuts-linux.pdf)
- [Microsoft's Visual Studio Code Keyboard Shortcuts for Mac](https://code.visualstudio.com/shortcuts/keyboard-shortcuts-macos.pdf)
