1. Home
  2. Computing & Technology
  3. Ruby

Using rails.vim

By Amanda & Michael Morin, About.com

3 of 6

Editing Rails Applications in Vim

Though it is possible to edit Rails applications in Vim without the help of any specialized scripts, the rails.vim script makes many tasks simpler. A good example is editing a controller file. Assuming your current directory is the application's base directory and you want to edit the Posts controller, a typical vim command might be :e app/controllers/posts_controller.rb. Though vim helps you out with tab completion, the rails.vim scripts makes it even easier. Simply run the command :Rcontroller posts.

The rails.vim script also gives easy access to scripts, generators and rake tasks. Some commands are very difficult to run in Vim, especially script/server. Since script/server never exits until you exit the server, running !script/server will never allow you to take control of Vim until you end the script. The rails.vim script gives you an :Rserver command that solves this problem.

Explore Ruby
About.com Special Features

Stay connected and entertained with reviews on tips on the latest HDTVs, cellphones and more. More >

Easy ways to connect two computers for networking purposes. More >

  1. Home
  2. Computing & Technology
  3. Ruby
  4. Ruby on Rails
  5. Editing Rails Applications in Vim

©2009 About.com, a part of The New York Times Company.

All rights reserved.