Factorus is a Vim plugin for automated refactoring. It provides renaming of methods and classes, encapsulation of variables, and even method extraction, with a few very intutitive commands.
The following table shows which features Factorus supports for which languages:
Add Parameter | Encapsulate Variable | Extract Method (Automated) | Extract Method (Manual) | Rename Argument | Rename Class | Rename Method | Rename Field | |
---|---|---|---|---|---|---|---|---|
Java | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
Python | ✓ | N/A | ✓ | ✓ | ✓ | ✓ | ✓ | N/A |
C/C++ | ✓ | N/A | ✓ | ✓ | ✓ | N/A | ✓ | ✓ |
Additionally, for C/C++, Factorus supports the following refactorings:
Rename Type | Rename Macro | Rename Namespace | |
---|---|---|---|
C/C++ | ✓ | ✓ | N/A |
NOTE: Factorus support for C++ currently uses the same code as for C; as such, Factorus may not work properly for more complex C++ code.
Factorus also has commands for reverting changes and rebuilding projects, for stability and sanity testing.
(All code shown either from spring-framework or git)
Factorus provides two functions for method extraction. The first, FExtractMethod, automatically finds a block of code that can be safely extracted:
If you prefer to manually extract a block of code, however, you can use FMExtractMethod (now deprecated, use FExtractMethod:
There are many ways to install Factorus. You can: