Sublime Forum

Renaming in Sublime Text

#1

Hello, I would love someone to create or tell me if there’s one plugin for at least C language, which could rename all the variables, functions etc. in the code when I’m changing one. For example:

int a;
…some code…
if(a > something)
a = something;
…some code…

So if I change a to for example b, a should change to b all over the code. It’s possible to do it with CTRL+D or Alt+F3 but that’s very inconvenient, because if you’ve got for example 2 variables:

char a, ab;

And if you want to change only a, Alt+F3 would change ab also.

0 Likes

#2

If you don’t have anything selected when you press control+D, it should select the variable and any subsequent presses of control+d will only select exact matches. So a will match but ab won’t. This behavior is different if you have something initially selected prior to pressing control+D, which will select subwords as well.

0 Likes

#3

Oh, cool! I didn’t know that. Thanks!

0 Likes

#4

Since this is one of the top results that comes up in Google when searching for “sublime refactor rename”, the LSP package (plus an appropriate LSP server for your language) provides this functionality in 2024:

0 Likes