Home > Ruby, vim > vim-ruby-refactoring – Add Parameter

vim-ruby-refactoring – Add Parameter

30 December, 2010

This post is part of a series which documents the vim-ruby-refactoring plugin.

Add Parameter

Simply adds a parameter (or many separated with commas) to a method.

The refactoring: http://www.refactoring.com/catalog/addParameter.html

Example

Before refactoring:AddParameter_Before
Move your cursor onto the method where you wish to add the parameter
Hit your <leader-key> then type rap
You will now see a prompt to enter the parameter name:
Parameter name: date

After refactoring:

AddParameter_After
The contact method now has a date parameter added.

rap is the default binding for this refactoring, think Refactor Add Parameter.

The default <leader-key> in vim is the ‘\’ key but you can remap this to any key you like.

About these ads
  1. No comments yet.
Comments are closed.
Follow

Get every new post delivered to your Inbox.

%d bloggers like this: