sponsor Vim development Vim logo Vim Book Ad

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

 script karma  Rating 6437/2237, Downloaded by 99341  Comments, bugs, improvements  Vim wiki

created by
Tim Pope
 
script type
utility
 
description
This is a massive (in a good way) Vim plugin for editing Ruby on Rails applications.

* 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 schema, template to helper, and controller to functional test.  Commands like :Emodel, :Eview, :Econtroller, are provided to :edit files by type, along with S, V, and T variants for :split, :vsplit, and :tabedit.  Throw a bang on the end (:Emodel foo!) to automatically create the file with the standard boilerplate if it doesn't exist.  :help rails-navigation

* Enhanced syntax highlighting.  From has_and_belongs_to_many to distance_of_time_in_words, it's here.

* Interface to the rails command.  Generally, use :Rails console to call rails console.  Many commands have wrappers with additional features: :Generate controller Blog generates a blog controller and loads the generated files into the quickfix list, and :Runner wraps rails runner and doubles as a direct test runner.  :help rails-exec

* Default task runner.  Use :Rails (with no arguments) to run the current test, spec, or feature.  Use :.Rails to do a focused run of just the method, example, or scenario on the current line.  :Rails can also run arbitrary migrations, load individual fixtures, and more.  :help rails-default-task

* Partial and concern extraction.  In a view, :Rextract {file} replaces the desired range (typically selected in visual line mode) with render '{file}', which is automatically created with your content.  In a model or controller, a concern is created, with the appropriate include declaration left behind.  :help rails-:Rextract

* Fully customizable. Define "projections" at the global, app, or gem level to define navigation commands and override the alternate file, default rake task, syntax highlighting, abbreviations, and more.  :help rails-projections.

* Integration with other plugins.  If dbext.vim is installed, it will be transparently configured to reflect database.yml.  Users of abolish.vim get pluralize and tableize coercions, and users of bundler.vim get a smattering of features.  :help rails-integration

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
 
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 5.4 2018-03-04 7.0 Tim Pope Fix issues with :Eview.
Fix :Clog.
Fix file creation on :confirm A.
Fix working directory in :Generate.
Fix :Rails g and other abbreviated commands on pre-5 Rails.
rails.zip 5.3 2017-06-08 7.0 Tim Pope Massive gf rewrite for better extensibility.
Greatly improved asset support.
Provide command line <C-R><C-F> with same logic as gf.
Support Rails 5 rails/rake unification.
Selectively delegate :Rails to rake on older Rails versions.
:Rails supersedes :Rake as default task dispatcher.
Add channel and serializer support.
Support tab/vert style mods on Vim 8.
Provide :Clog to load logs into quickfix list.
Update syntax highlighting for Rails 5.1.
Use filetype=eruby.yaml for yaml files.
Refactor to use projections for much of internal implementation.
Enable :Econtroller to edit controller concerns.
Rearrange and clean up help.
Drop legacy (non asset pipeline) Less CSS and CoffeeScript support.
Formally deprecate R commands.
rails.zip 5.2 2015-05-07 7.0 Tim Pope Add rails compiler plugin and use it for :Rails, :Rake, and :make.
Provide dispatch.vim configuration.
Support projectionist.vim compatible projections. Old % style is deprecated.
Improve support for view variants.
Support asset pipeline with gf.
Drop first extension from .css.scss, per Rails 5.
Provide :Ejob.
Support rails_helper.rb from rspec 3 on :Eintegrationtest.
Add alternate file support for CoffeeScript.
Add test/controllers file to view tests.
Require app/ for app detection (fixes false positive on Lotus).
Support detecting unicorn pid and binding.
Use routes to determine default :Rpreview location.
Fix failure to define :OpenURL.
Provide more :Rake defaults.
Change :Rake migration default to db:migrate:redo.
Change :Rake fallback from default to --tasks.
Support Bundler 2.
Syntax highlighting updates.
Switch ctags --language from -javascript to ruby.
Prefer .ctags over g:rails_ctags_arguments.
Warn about deprecated :R commands.
rails.zip 5.1 2014-04-01 7.0 Tim Pope Modernize choice of rake task for running individual tests.
Support gf for jbuilder partials.
Support db/structure.sql.
Support app/assets/ file creation (as opposed to public/).
Highlight custom keywords in eruby and haml.
Miscellaneous syntax highlighting additions.
Eliminate assorted low value syntax highlighting tricks.
Drop automatic set completefunc=syntaxcomplete#Complete.
Improve log file syntax highlighting.
Eliminate log file syntax folding for massive speed boost.
Add g:rails_no_dbext to disable automatic dbext config.
Partial forward compatibility with projectile.vim style projections.
Fix :Rlocale with no argument.
Fix :.Rake in a .task file.
Fix relative directories in 'path'.
Fix unintentional jumps into required files.
Assorted alternate file fixes and enhancements.
Assorted fixes to Rails app detection.
Assorted buffer load performance improvements.
rails.zip 5.0 2013-04-01 7.0 Tim Pope "Projections" greatly enhance the configurability of rails.vim.  See the help.
Drop R from navigation commands (:Emodel, :Smodel, etc).  Old commands are still supported.
Navigation commands provide boilerplate on file creation.
Run tests with :Rrunner.
Load :Rails new/:Rgenerate/:Rdestroy results into quickfix.
Assorted Rails 4 updates.
:Rails replaces deprecated :Rscript.
Extract concerns and helpers with :Rextract.
Switch :Elib default to Gemfile.
Switch :Emigration 0 to db/seeds.rb.
Add :Eschema navigation command.
Remove support for plugins, including navigation command.
Detect and support engines with bundler.vim.
Better :Rpreview support for finding the currently running server.
Indent settings are no longer automatically adjusted.  Try sleuth.vim.
Remove configuration provisions superseded by projections.
Remove assorted seldom used features.
rails.zip 4.4 2011-09-01 7.0 Tim Pope Support Rails 3.1 assets (smarter :Rjavascript and :Rstylesheet).
Support RSpec 2 backtrace format in :Rake.
Support rename_index in :Rinvert.
Support slim template type.
Better support for Rails 3 style `:Rails new foo`.
Link Gemfile and Gemfile.lock with :A.
Add bundler.vim support.
Syntax highlight `execute` in migrations.
Syntax highlight `attr_readonly` [Adam Vaughan].
Syntax highlight `around` in specs [Cássio Marques].
Fix Oracle dbext support [Mark Roghelia].
Fix singularization of "movies".
Fix gf on render :partial => 'foo/bar.html'.
Fix gf with Ruby 1.9 hashes.
Remove AWS abbreviation.
Remove statusline indicator.
Remove project.vim support.
rails.zip 4.3 2010-09-10 7.0 Tim Pope Support :Rails new app for Rails 3.
Add support for CoffeeScript, LESS CSS, and SCSS.
Syntax highlighting updates for Rails 3 and RSpec 2.
Support for RSpec 2's spec/requests.
Support :.Rake in test 'foo' do ... end.
:Rake in quickfix window reruns last rake task.
:Rake - reruns last rake task.
:Rake in views runs view specs.
Support test/unit/helpers.
:A from app/weird/foo.rb to spec/weird/foo_spec.rb.
Enable omnicomplete in Haml views.
Also create :RD commands with :Rnavcommand.
Fix gf on "include Namespaced::Module".
Fix Windows "C:" versus "c:" issue.
Change cookies abbreviation from co to coo (so one can type co.uk).
rails.zip 4.2 2010-03-13 7.0 Tim Pope Default :Rlib to db/seeds.rb.
Default :Rplugin to Gemfile.
:Renvironment prefers Rails 3's config/application.rb.
Support script/rails from Rails 3.
Update generator completion for Rails 3.
Syntax highlighting and gf support in Rails 3 routes.
Update syntax highlighting for assorted Rails 3 changes.
Add support for Rails 3 mailers.
Add :Rmailer navigation command.
Add abbreviations for ActiveModel/ActionDispatch.
Expose pluralization as abolish.vim (vimscript #1545) coercions t and l.
Add support for allml.vim replacement ragtag.vim (vimscript #1896).
Highlight its, expect, and double from RSpec.
Fix parsing of Test::Unit failures.
Add support for tmux (like GNU screen) [Will Gray].
Disable menu in MacVim by default to eliminate weird terminal output.
Eliminate g:rails_expensive, g:rails_dbext, and g:rails_default_database.
rails.zip 4.1 2009-12-18 7.0 Tim Pope Completely eliminate usage of if_ruby.
Highlight *_via_redirect in tests and raw in views.
Support gf on stylesheets/javascripts when extension is given.
License clarification to enable distribution in Debian.
Explain that donations on Github through Pledgie are matched and given to ICCF.
rails.zip 4.0 2009-10-04 7.0 Tim Pope Remove all deprecated commands.
Update syntax highlighting for Rails 2.3.4.
Fix bug when path to application contains whitespace.
:Rtree spawns NERDTree. :Rproject is deprecated.
Ignore all Javascript with :Rtags.
Assorted changes to dbext support.
Clean up verbosity in statusline.
Fix bugs in :Rfixtures.
:Rlocale navigation command.
:Rintegrationtest knows about integration specs.
:RD family of commands for reading in a file.
:R in model is now schema definition (die, annotated_models).
:A in view now always tries for a spec or test, not a helper.
:R/:A jump to next/previous timestamped migration.
:1R filename calls :Rfind filename.
:0R is the same as :A and :.A is the same as :R.
Cease setting makeprg.
:Rake opens error window (:cwindow).
:Rake in db/seeds.rb runs rake db:seed.
:.Rake in controller runs rake routes CONTROLLER=.
Document :Rake default tasks.
rails.zip 3.4 2009-03-27 7.0 Tim Pope Load rake stats, routes, notes, etc into quickfix window.
:Rake! doesn't jump to first error.
:Rmetal navigation command.
:Rintegrationtest edits cucumber features.
:Rstylesheet edits sass if present.
Preserve case with :Rjavascript and :Rstylesheet.
Option for :Rtags to override ctags arguments.
Rails 2.3 gf support: render 'foo', ApplicationController.
Rails 2.3 and additional rspec syntax highlighting.
rails.zip 3.3 2009-01-23 7.0 Tim Pope :Rtags ignores jquery plugins (can trip up ctags).
:Rtags indexes .rake, .rjs, and .builder files [Mark Wilden].
:Rproject is more robust against missing directories [Mark Wilden].
:Rproject uses NERDTree if project.vim not present.
Highlight #default_scope in models; setup/teardown/test in tests [Daniel Schierbeck].
:.Rake in a migration method runs db:migrate:up or db:migrate:down.
Gracefully ignore leading underscore in :Rextract _foo.
Navigation commands accept a line number (:Redit Rakefile:5).
:Rmigration with no argument always jumps to latest migration.
:Renvironment and :Rinitializer navigation commands.
rails.zip 3.2 2008-11-13 7.0 Tim Pope Fix :Rview when the cwd isn't the rails root.
Fix edge case with :Rscript family on Windows.
Use new autocmd interface of dbext 8.00.
Fix :Rp, :Rpp, :Ry.
Miscellaneous tab complete fiddling.
:Rake in a cucumber feature runs that feature.
Pluralization for alias, status, index, and vertex.
rails.zip 3.1 2008-10-24 7.0 Tim Pope Update helpers to Edge Rails.
:Rmigration 0 edits db/schema.rb.
:Rake now defaults to full test/spec (:.Rake for a focused run).
Remove Vim 7 clauses from documentation.
:Redit . edits Rails root.
Fix tab completion bugs.
Fix :Rails command.
rails.zip 3.0 2008-10-17 7.0 Tim Pope Major refactoring to take advantage of Vim 7 features (please report any regressions).
Smart, app dependent menus for generators and rake tasks.
Smart, app dependent tab completion for generators, rake tasks, and environments.
Crude fuzzy tab complete: :Rmodel um<Tab> could expand to user_mailer.
:Rlib with no argument is now a shortcut to config/routes.rb.
:Rintegrationtest with no argument now a shortcut to test/test_helper.rb.
:Rspec navigation command.
:Runittest also navigates to model specs.
:Rfunctionaltest also navigates to controller specs.
:Rfixtures finds extensionless rspec fixtures.
:Rake line number argument. :8Rake to run the test on line 8.
:0Rake forces all tests to run.
:Rake in a spec scopes by line number.
:Rake in an app/ file runs the corresponding spec (if no test exists).
:Rake in config/routes.rb runs rake routes.
:Rake in a fixtures file runs db:fixtures:identify LABEL=identifier.
:0Rake in a fixtures file runs db:fixtures:load FIXTURES=name.
:Rtags now creates tags file in tmp (for easier SCM ignoring).
Fix :Rgenerate migration to properly jump to timestamped migrations.
rails.zip 2.1 2008-10-09 6.0 Tim Pope Syntax highlighting updates.
Tweaks to gf algorithm to find views and add include/extend support.
:Rcd and :Rlcd tab completion.
:Rake in a spec scopes by line number.
Fix :A for lib/view/nested-controller specs.
Detect model name in object daddy exemplars (for use with :Rmodel, etc)
Point docs at github repository.
rails.zip 2.0 2008-05-26 6.0 Tim Pope New git friendly versioning scheme.
Extract rails_tabstop feature to vimscript #2253.
Tab completion of timestamped migrations.
Work around nonzero exit status on Leopard.
Minor bug fixes.
rails.zip 256 2008-02-17 6.0 Tim Pope Added an autoload file, greatly reducing the code loaded at startup.
Highlight omitted assert_tag and assert_no_tag methods in tests.
OS X now more liberally detected when choosing a browser.
Handle plain files with gf.
rails.zip 239 2008-01-03 6.0 Tim Pope Miscellaneous Rails 2.0 related tweaks.
Commands like :Rconsole now work with Cygwin Ruby.
Rudimentary HAML support.
rails.zip 222 2007-11-02 6.0 Tim Pope :Rake runs rake spec inside a spec.
Rails 2.0 cleanups and tweaks
rails.zip 216 2007-09-06 6.0 Tim Pope Refactoring.  Please report any regressions.
:Rpreview utilizes "# GET /foos/1" style comments.
:Rake in a migration defaults to migrating to the currently edited version.
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
ip used for rating: 142.132.191.50

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 the maillist. Help Bram help Uganda.
   
Vim at Github