I used Netbeans before. How do I do some refactoring (changing variable names, make method out of code, etc) in Sublime Text 2 on a Mac? What I'm doing right now is "select next instance of a word", but that's only because I'm using only one file
You must press ctrl+D again to get additional selections in the file. For mac user: i prefer to use command+D. Press the buttons together multiple times to select the items to refactor.
The simplest way: put cursor on name, alt+f3 (select all), then type your new variable name. In case there is multiple stuff named name but you don't want to change them all: put cursor on name, ctrl+d every time you want to accept the selection and ctrl+k,ctrl+d if you want to skip the selection and go to the next.
What works for me is the "Find all" option (Ctrl+F and Alt+Enter).
This way you can edit the text and all the matches will be edited at same time.
I wrote this plugin for JavaScript refactoring https://github.com/s-a/sublime-text-refactor
I guess there are a lot more out there supporting RoR.
What happened here was that I just did refactoring via grepping and find/replace. I'm on Vim now and substitute/grepping is still my method when I need to refactor. I guess this is one of the features that an IDE provides that a text editor doesn't.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With