/rails.vim

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

Primary LanguageVimL

This is a mirror of http://www.vim.org/scripts/script.php?script_id=1567

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. 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.

4. Enhanced syntax highlighting.  From has_and_belongs_to_many to distance_of_time_in_words, it's here.  For easy completion of these long method names, 'completefunc' is set to enable syntax based completion on CTRL-X CTRL-U.

5. Interface to rake.  Use :Rake to run the current test, spec, or feature.  Use :.Rake to do a focused run of just the method, example, or scenario on the current line.  :Rake can also run arbitrary migrations, load individual fixtures, and more.

6. Interface to script/*.  Generally, use ":Rscript about" to call "script/about" or "script/rails 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.  :Rtree spawns NERDTree.vim.  If dbext.vim is installed, it will be transparently configured to reflect database.yml.  Cream users get some additional mappings, and all GUI users get a menu.

If you like rails.vim and use Git, please Watch the repository on Github at http://github.com/tpope/vim-rails, and try my Git wrapper fugitive.vim: vimscript #2975 http://github.com/tpope/vim-fugitive