sponsor Vim development Vim logo Vim Book Ad

rails.vim : Ruby on Rails: easy file navigation, enhanced syntax highlighting, and more

 script karma  Rating 1273/434, Downloaded by 8741

created by
Tim Pope
 
script type
utility
 
description
TextMate may be the latest craze for developing Ruby on Rails applications, but Vim is forever.  This plugin offers the following features for Ruby on Rails application development.

1. Automatically detects buffers containing files from Rails applications, and applies settings to those buffers (and only those buffers).  You can use an autocommand to apply your own custom settings as well.

2. Unintrusive.  Only files in a Rails application should be affected; regular Ruby scripts are left untouched.  Even when enabled, the plugin should keep out of your way if you're not using its features.

3. Provides reasonable settings for working with Rails applications.  Rake is the 'makeprg' (and it always knows where your Rakefile is), 'shiftwidth' is 2, and 'path' includes an appropriate collection of directories from your application.

4. Easy navigation of the Rails directory structure.  gf considers context and knows about partials, fixtures, and much more.  There are two commands, :A (alternate) and :R (related) for easy jumping between files, including favorites like model to migration, template to helper, and controller to functional test.  For more advanced usage, :Rmodel, :Rview, :Rcontroller, and several other commands are provided.

5. Enhanced syntax highlighting.  From has_and_belongs_to_many to distance_of_time_in_words, it's here.  For Vim 7 users, 'completefunc' is set to enable syntax based completion on CTRL-X CTRL-U, making it easy to complete such long method names.

6. Interface to script/*.  Generally, use ":Rscript about" to call "script/about".  Many commands have wrappers with additional features: ":Rgenerate controller Blog" generates a blog controller and edits app/controllers/blog_controller.rb.

7. Partial extraction and migration inversion.  :Rextract {file} replaces the desired range (ideally selected in visual line mode) with "render :partial => '{file}'", which is automatically created with your content.  The @{file} instance variable is replaced with the {file} local variable.  :Rinvert takes a self.up migration and writes a self.down.

8. Integration with other plugins.  :Rproject creates a new project.vim (vimscript #69) project.  :Rdbext loads database settings from database.yml for dbext.vim, vimscript #356 (and this happens by default under most situations).  Cream users get some additional keybindings, and all GUI users get a menu.

This plugin is ever evolving but is in a stable, highly usable state.  Feedback welcome and encouraged.  For more information, see the official website at http://rails.vim.tpope.net/ .
 
install details
Extract the zip file to ~/.vim (or vimfiles on Windows).  To use the help, see :help add-local-help.  In a nutshell, :helptags ~/.vim/doc.

For details, see :help rails
 

rate this script Life Changing Helpful Unfulfilling 
script versions (upload new version)

Click on the package to download.

package script version date Vim version user release notes
rails.zip 200 2007-05-31 6.0 Tim Pope Anniversary edition:
Greatly enhanced documentation.
Proper gf support for named route helpers (edit_post_url).
Syntax highlighting for custom assertions from test_helper.rb.
rails.zip 192 2007-05-17 6.0 Tim Pope :Rails works again.
:R jumps between config/database.yml and config/environments/*.rb
rails.zip 190 2007-05-15 6.0 Tim Pope Partial support for nested extensions from edge (index.html.erb)
:Rpp and Ry evaluate ruby and pretty print/YAML dump the result.
:Rplugin navigation command.
Fixed multiple bugs peculiar to Vim 6.2.
Other small bug fixes and enhancements.
rails.zip 180 2007-04-17 6.0 Tim Pope :Rtask now additionally looks in the currently edited plugin's task directory.
:Rlib navigation command looks for files in the lib directory and the current plugin's lib directory.
:Rcommand creates custom navigation commands.
:Rrefresh clears certain cached data. :Rrefresh! reloads rails.vim.
Added a browsefilter (for win32 file dialogs).
rails.zip 175 2007-03-30 6.0 Tim Pope Highlight user classes (models, etc.) with the railsUserClass group.
Static list of highlighted helper methods (speeds up initialization).
HTML highlighting occurs inside string literals like %Q<Hello <b>world</b>>.
Recognize .erb and .builder extensions from edge Rails.
:Rtask navigation command.
rails.zip 166 2007-02-27 6.0 Tim Pope Prototype syntax highlighting.
Improved errorformat, and an alternate format on :Rake! for backtraces.
More robust database.yml loading for dbext.
rails.zip 150 2007-01-28 6.0 Tim Pope Fixed stack overflow when used in conjunction with rubycomplete.vim.
Improved speed in certain setups on network file systems.
More Rails 1.2 goodies, including limited gf on url helpers.
rails.zip 144 2007-01-17 6.0 Tim Pope Syntax highlighting for routes.
Updates for Ruby on Rails 1.2 (primarily syntax highlighting, and a few abbreviations).
Tiny little bug fixes.
rails.zip 140 2007-01-05 6.0 Tim Pope :Rstylesheet and :Rjavascript commands.
Better tab completion for some file editing commands.
GUI menu for recently edited projects.
Certain expensive operations now enabled by default.  See :help rails-slow if you have any noticable delays.
rails.zip 132 2006-11-01 6.0 Tim Pope ":Rmodel ." will open app/models.  Other commands follow suit.
Support for surround.vim, vimscript#1697.
Miscellaneous bug fixes and cleanups.
rails.zip 128 2006-08-16 6.0 Tim Pope Improved documentation.
Minor bug fixes.
Deprecated :Rpartial in favor of :Rextract.
rails.zip 123 2006-08-04 6.0 Tim Pope Quieter error messages (less "Press ENTER").
Fully functional modelines, including method local modelines.
:Rmodel, :Rview, :Rcontroller, plus 9 other similar commands.
rails.zip 113 2006-07-19 6.0 Tim Pope Bugfix for error messages in 6.x (apparently string() was added in 7.0)
rails.zip 111 2006-07-17 6.0 Tim Pope Abbreviations.
:Rinvert to write a self.down migration.
:Rset for per-app/buffer/method configuration.
Preliminary modelines (disabled by default).
rails.zip 100 2006-07-02 6.0 Tim Pope :Rserver to start a new server, :Rserver! to kill old server first.
Other new commands.
Improved 'errorformat'.
Integration with dbext.vim.
GUI menu.
Robustness, robustness, robustness.
Miscellaneous bug fixes and tweaks.
And as always, more...
rails.zip 69 2006-06-16 6.0 Tim Pope rails_level now defaults to 3.
a.vim compatible commands (:A et al).
autocmds for specific file types (e.g. models)
minimal syntax based user completion function (^X^U).
:Rlog and log syntax highlighting.
:Rproject - create/find a project.vim project.
and more...
rails.zip 37 2006-06-06 6.0 Tim Pope Lots of new features:
Easy configuration with g:rails_level.
:Rgenerate controller Foo generates and edits foo_controller.rb.
<LocalLeader>rm and <LocalLeader>ra for good clean fun.
Smarter partial extraction with :Rpartial.
And more...
rails.zip 18 2006-05-31 6.0 Tim Pope Initial upload

If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to vim@vim.org after searching the archive. Help Bram help Uganda.
   
Sponsored by Web Concept Group Inc. SourceForge.net Logo