Skip to content

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

Notifications You must be signed in to change notification settings

vim-scripts/rails.vim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

37 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

Remember when everybody and their mother was using TextMate for Ruby on Rails development?  Well if it wasn't for rails.vim, we'd still be in that era.  So shut up and pay some respect.  And check out these features:

* 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.  For easy completion of these long method names, 'completefunc' is set to enable syntax based completion on CTRL-X CTRL-U.

* 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.  :help rails-rake

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

* 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

About

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

Resources

Stars

Watchers

Forks

Packages

No packages published