Ruby Refactoring…

There’s a plugin that does this. It’s described here.

The plugin is hosted on git, here.

The code for the plugin is pretty well documented, and might be readable if I knew vimscript (which I am starting to do)

The default bindings are:

rap = refactor add parameter
rcpc = convert post conditional
rel = extract let (for RSpec)
rec = extract constant
relv = extract local variable
rit = inline temp
rlv = rename local variable
riv = rename istance variable
em = extract method—probably the most

:nnoremap <leader>rap  :RAddParameter<cr>
:nnoremap <leader>rcpc :RConvertPostConditional<cr>
:nnoremap <leader>rel :RExtractLet<cr>
:vnoremap <leader>rec :RExtractConstant<cr>
:vnoremap <leader>relv :RExtractLocalVariable<cr>
:nnoremap <leader>rit :RInlineTemp<cr>
:vnoremap <leader>rrlv :RRenameLocalVariable<cr>
:vnoremap <leader>rriv :RRenameInstanceVariable<cr>
:vnoremap <leader>rem :RExtractMethod<cr>
em is about 7KB in length. The rest are 1KB = about 30 lines of code.
Might be interesting to write some more.

Comments

Popular Posts