How to change all instances in VS Code

Jugo Mobile
By
Jugo Mobile
Jugo Mobile is a platform dedicated to high-quality content in gaming, sports, and tech. Engage with high-quality content and connect with fellow enthusiasts and experts. Explore...
5 Min Read

It may be rare, but sometimes you will need to change some attributes to ensure they don’t share a name. For example, you may have written a standalone function that mentions a completely different element using the same name and you need to differentiate between them.

For large projects, this may mean going through hundreds or thousands of lines at a time. Fortunately, Visual Studio Code has a handy shortcut that lets you select a particular element, line, or column throughout the project and edit all of its instances at once. Continue reading to learn more.

How to change all instances on a Windows PC

If you want to change all instances of a word at once in Windows, you need to do the following:

  1. Select a particular item or value that you want to change.
    1713481962 468 How to change all instances in VS Code
  2. To select all instances of that element, use the keyboard shortcut “CTRL + SHIFT + L”.
    1713481963 120 How to change all instances in VS Code
  3. All instances should be highlighted throughout the code, with a cursor at the end.
    1713481963 868 How to change all instances in VS Code
  4. With multi-cursor mode on, make changes to the word as needed (or enter additional text later). Click anywhere within the code to exit multi-cursor mode and return to a single cursor.

In case you want to select instances one at a time, the process is a little different and is as follows:

  1. Choose the item or value you want to change.
    1713481962 468 How to change all instances in VS Code
  2. Press “CTRL + D” to select the next instance, then again for the next one, and so on.
    1713481963 512 How to change all instances in VS Code
  3. You can change all selected instances directly.
    1713481963 868 How to change all instances in VS Code
  4. Exit multi-cursor mode by clicking anywhere within the code.

How to change all instances on a Mac

VS Code works similarly on all platforms. One of the few differences lies in the keyboard shortcuts because each system uses various keyboard settings and defaults.

Once you open your code and determine the word you want to replace, the procedure to change all instances is as follows:

  1. Click anywhere within the word you want to mass edit.
    1713481963 523 How to change all instances in VS Code
  2. Press “CMD + SHIFT + L” to highlight and select all instances in the entire code and enter multi-cursor mode. The cursors go to the end of the word by default and have the word selected.
    1713481963 919 How to change all instances in VS Code
  3. Make any changes as you see fit (you are not limited to the selected word and can add text beyond it).
    1713481963 785 How to change all instances in VS Code
  4. Close multi-cursor mode by clicking anywhere within the editor.

You can also enter multi-cursor mode by sequentially adding instances of a word or attribute to the selection. That is how:

  1. Select the word you want to edit.
    1713481963 523 How to change all instances in VS Code
  2. Press “CMD + D” to select the next instance in the code.
    1713481964 814 How to change all instances in VS Code
  3. Repeat step 2 until you reach a point in the code where you do not need to make any changes.
  4. Edit the selected word as necessary.
    1713481963 785 How to change all instances in VS Code
  5. Click anywhere to return to single cursor mode.
    1713481964 460 How to change all instances in VS Code

How to change all instances in Linux

VS Code on Linux shares keyboard shortcut settings with Windows.

If you want to change all instances of a word at once, here’s what you do:

  1. Select the word you need anywhere in the code.
    1713481964 220 How to change all instances in VS Code
  2. Press “CTRL + SHIFT + L” to select all instances of that element in the entire code. All instances should be highlighted, with a cursor at the end, and the platform edits in multi-cursor mode.
    1713481963 120 How to change all instances in VS Code
  3. Enter the changes you want. The editor will work on all selected changes simultaneously.
    1713481965 588 How to change all instances in VS Code
  4. Click anywhere else to return to a single cursor when you’re done.

If you want to be more precise (such as keeping new instances the same), you can select sequentially. That is how:

  1. Select a word that needs to be changed.
    1713481964 220 How to change all instances in VS Code
  2. Press “CTRL + D” to select the next instance. Note that this opens editing with multiple cursors.
    1713481963 512 How to change all instances in VS Code
  3. Repeat Step 2 until you reach the part of the code that can remain as is.
  4. Make edits to the selected words.
    1713481965 588 How to change all instances in VS Code
  5. Exit multiple cursor selection by clicking anywhere.

Other tips

VS Code has many other nifty shortcuts, like “Shift + Alt,” which creates a column box for multi-row changes or selects a line by clicking its line number.

Did you know these shortcuts for VS Code? Is there any other code editor you prefer to use? Where do you get your coding materials and instructions? Be sure to share it with us in the comments!

Share This Article
Follow:
Jugo Mobile is a platform dedicated to high-quality content in gaming, sports, and tech. Engage with high-quality content and connect with fellow enthusiasts and experts. Explore the latest trends and innovations in our vibrant community. Join us and experience the future today!
Leave a Comment
Grow your brand and reach a larger audience. Advertise with us today and get noticed by thousands.
© 2025 Jugo Mobile. All Rights Reserved.