Create Migrations Faster with Vim-Rails
Not only can we create database migrations with vim-rails, it's faster than using a generator. I counted the steps today and realized I was wasting precious keystrokes by underutilizing this great plugin.
Here's how I was setting up a migration:
- Generate the migration:
$ rails g migration add_diameter_to_wheels
-
Load the migration in Vim with
:Emigration(vim-rails) -
Replace
changemethod withupanddownmethods
Here's my improved method:
-
Generate a migration (in Vim) with
:Emigration AddDiameterToWheels! -
Create
upanddownmethods
Less steps and characters, and best of all, we never have to leave Vim.
h/t Chris Erin
Tweet