Quicker replace var name

I saw in a video this one guy copy and paste a section of code, then he must have hit some combo keys and he changed a variable name and all the names below changed as well, with no sub-menus popping up. It was beautiful!

Right now, the way I do it is to select a section of code and CNTRL + D to copy it. Then CNTRL + H to replace, for which I have to type in the original var name and the new name. How can I achieve this like that one guy did or a similar faster way? Basically it should only affect the variables in the new copied section.

RENAME MULTIPLE IDENTICAL VARIABLES (BUT NOT NECESSARILY ALL IN FILE):
METHOD 1:
Select block of code, then CNTRL + H and type in replacement name.

METHOD 2:
A) Select entire var name & then hold CNTRL + ALT while double click on next var to be added as part of the group selection.
B) Place cursor at var name location want to start mod, then move mouse cursor over next var & press CNTRL + ALT to place new cursor & type new name.

METHOD 3:
Right click on variable name & select “Rename” or CNTRL + R twice on var name. Can also highlight name 1st then CNTRL + R once. In preview (no skip preview, unchecked), be sure to uncheck ALL other var’s that do not require change.
Posting the URL of the video might be a start.
Is it multi-caret editing (on visual studio)? You highlight the variable name, press Shift + Alt + . the number of occurrences afterwards you want to change, then start renaming it and it will rename the other occurrences as well.

You can also do CTRL + Alt and highlight everywhere you want the change to occur manually, then just start renaming it.


And not to be terrible, I like seeing activity in this forum, but chatGPT would have given you the answer lmao
Last edited on
Registered users can post here. Sign in or register to post.