Skip to content

Refactoring for the rest of us! (automated refactoring in vim)

License

Notifications You must be signed in to change notification settings

apalmer1377/factorus

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Factorus: automated refactoring in Vim

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.

Features

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.

Examples

(All code shown either from spring-framework or git)

Rename Class

renameClass

Rename Field

renameField

Rename Method

renameMethod

Rename Type

renameType

Rename Macro

renameMacro

Rename Arg

renameArg

Add Parameter

addParam

Encapsulate Field

encapsulateField

Extract Method

Factorus provides two functions for method extraction. The first, FExtractMethod, automatically finds a block of code that can be safely extracted:

extractMethod

If you prefer to manually extract a block of code, however, you can use FMExtractMethod (now deprecated, use FExtractMethod:

manualExtractMethod

Installation

There are many ways to install Factorus. You can:

  • Use a plugin manager like pathogen or vim-plug (Recommended),
  • Clone the repository into your 'runtimepath', or
  • Download the tar file from vim.org and extract it into your 'runtimepath'.

Dependencies

Vim 7.0