How to change all selected words at once in Vscode

Asked

Viewed 16,554 times

4

Hello would like to know how to change all words at once in the visual studio code

thank you

  • 1

    If they are selected, just type in the new one. VS Code has multicursor support.

  • 3

    Your question is not very clear, but if you change all the same words in the open file you can do by selecting the word and pressing Ctrl + F2 and writing what he wants on top

5 answers

6

There are three ways:

1 - Selection of Lines

You can place multiple cursors by pressing Alt+Click in the place you want to add a new course, perform an action, like add letters or remove, Vscode does this in all active cursors:

VScode multi-cursores

You can place new cursors by pressing Shift+Alt+Down and Shift+Alt+Down. These shortcuts put a new cursor exactly at the same position as the first one line down and a line up respectively.

2 - Via Search Menu

Open the search menu and expand by clicking the left arrow:

expandindo menu de busca

3 - Via shortcut to replacement field

Press Ctrl+Shift+H

  • 2

    There is one more way: select a word, right-click and choose "change all occurrences".

3

Another option is to select the word you want, then press alt+D, every time you squeeze alt+D he will select this word throughout his project, then just type in the new one that he replaces in everything.

In my case I changed the default of Vscode to be equal to the sublime text, I changed the ALT by CTRL. you do this in the settings of Vscode

  • On macOS works with keys cmd + D, but not all are selected. Each cmd + D will add the selection to the next selected word.

3

We have the CTRL+F2 (Vscode for Windows), Basque put the cursor over the word (via arrow or mouse) and press that all will be changed. You use the ESC to get out

-1

I managed using the cmd Ctrl + D

-1

press CTRL+SHIFT+H In Vscode it will open in the left corner a kind of mass toggle replace so that you can change several words at once

  • Opa! Improve your response, explain better so the staff can understand.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.