Skip to content
This repository has been archived by the owner on Mar 27, 2023. It is now read-only.

killphi/vim-ruby-refactoring

 
 

Repository files navigation

Ruby Refactoring Tool for Vim

Build Status
Currently in 100% VimL, but might move toward a Ruby implementation sometime.

N.B. 'Rename Local Variable', 'Rename Instance Variable' and 'ExtractMethod' require matchit.vim, so it is loaded by default. This should not cause any problems, but if it does, let us know.

Implemented commands/patterns:

:RAddParameter           - Add Parameter
:RInlineTemp             - Inline Temp
:RConvertPostConditional - Convert Post Conditional
:RExtractConstant        - Extract Constant          (visual selection)
:RExtractLet             - Extract to Let (Rspec)
:RExtractLocalVariable   - Extract Local Variable    (visual selection)
:RRenameLocalVariable    - Rename Local Variable     (visual selection/variable under the cursor, *REQUIRES matchit.vim*)
:RRenameInstanceVariable - Rename Instance Variable  (visual selection, *REQUIRES matchit.vim*)
:RExtractMethod          - Extract Method            (visual selection, *REQUIRES matchit.vim*, doesn't work currently)

Default bindings:

: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>

Documentation

Relish Feature Docs

Usage Examples (thanks Justin!)

Credits

Original authors: Enrique Comba Riepenhausen & Paul King

Original idea came from Gary Bernhardt, who presented his vim configuration in the Software Craftsmanship User Group UK and showed two refactoring patterns he has written in vim script.

About

Refactoring tool for Ruby in vim!

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Vim Script 78.5%
  • Ruby 20.6%
  • Shell 0.9%