Ⅰ. 插件描述
Refactoring tool for Ruby in vim!Ⅱ. 基本信息
|
Ⅲ. 安装方法
使用Vundle管理器安装
在你的.vimrc下添加:Plugin 'rking/vim-ruby-refactoring-back-to-december'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall
对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。
使用NeoBundle管理器安装
在你的.vimrc下添加:NeoBundle 'rking/vim-ruby-refactoring-back-to-december'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall
使用VimPlug管理器安装
在你的.vimrc下添加:Plug 'rking/vim-ruby-refactoring-back-to-december'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall
使用Pathogen管理器安装
在终端中运行以下命令:cd ~/.vim/bundle
git clone https://github.com/rking/vim-ruby-refactoring
Ⅳ. 文档说明
# Ruby Refactoring Tool for Vim
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*)
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
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.