Are you happy with your logging solution? Would you help us out by taking a 30-second survey? Click here

vim-rails

rails.vim: Ruby on Rails power tools

Subscribe to updates I use vim-rails


Statistics on vim-rails

Number of watchers on Github 3472
Number of open issues 38
Average time to close an issue 21 days
Main language VimL
Average time to merge a PR 8 days
Open pull requests 10+
Closed pull requests 19+
Last commit over 1 year ago
Repo Created about 11 years ago
Repo Last Updated over 1 year ago
Size 2.48 MB
Homepage http://www.vim.or...
Organization / Authortpope
Contributors63
Page Updated
Do you use vim-rails? Leave a review!
View open issues (38)
View vim-rails activity
View on github
Fresh, new opensource launches 🚀🚀🚀
Trendy new open source projects in your inbox! View examples

Subscribe to our mailing list

Evaluating vim-rails for your project? Score Explanation
Commits Score (?)
Issues & PR Score (?)

rails.vim

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, :Extract {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-:Extract

  • 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 dispatch.vim is installed, :Rails and other command wrappers will use it for asynchronous execution. Users of db.vim and dbext get easy access to their application's database. Users of abolish.vim get pluralize and tableize coercions, and users of bundler.vim get a smattering of features. :help rails-integration

Installation

If you don't have a preferred installation method, I recommend installing pathogen.vim, and then simply copy and paste:

cd ~/.vim/bundle
git clone https://github.com/tpope/vim-rails.git
vim -u NONE -c "helptags vim-rails/doc" -c q

While not strictly necessary, bundler.vim and dispatch.vim are highly recommended.

FAQ

I installed the plugin and started Vim. Why does only the :Rails command exist?

This plugin cares about the current file, not the current working directory. Edit a file from a Rails application.

I opened a new tab. Why does only the :Rails command exist?

This plugin cares about the current file, not the current working directory. Edit a file from a Rails application. You can use :AT and the :T family of commands to open a new tab and edit a file at the same time.

Can I use rails.vim to edit Rails engines?

It's not supported, but if you touch config/environment.rb in the root of the engine, things should mostly work.

Can I use rails.vim to edit other Ruby projects?

I wrote rake.vim for exactly that purpose. It activates for any project with a Rakefile that's not a Rails application.

What Rails versions are supported?

All of them, although you may notice a few minor breakages if you dip below 3.0. A few features like syntax highlighting tend to reflect the latest version only.

Didn't rails.vim used to handle indent settings?

It got yanked after increasing contention over JavaScript. Check out sleuth.vim.

Self-Promotion

Like rails.vim? Follow the repository on GitHub and vote for it on vim.org. And if you're feeling especially charitable, follow tpope on Twitter and GitHub.

License

Copyright (c) Tim Pope. Distributed under the same terms as Vim itself. See :help license.

vim-rails open issues Ask a question     (View All Issues)
  • about 3 years :Rails command has duplicate
  • over 3 years Some callbacks can't be recognized in vim
  • over 3 years :Rgenerate migration add_foo_to_bar isn't working properly. Plz, help!
  • over 3 years Make Rextract quotes configurable (so that one can use single quotes)
  • almost 4 years :A doesn't check app/lib
  • almost 4 years :AV with preprocessors
  • about 4 years sourcing .vimrc which includes either of two other plugins causes error with rails compiler
  • over 4 years Cursor movement slows to a crawl, temp fixed with :syntax off/on
  • almost 5 years Let :A edit requests spec
  • about 5 years rails .html.slim syntax highlight
  • about 5 years Rgenerate , env: ruby.exe: No such file or directory error
  • about 5 years supporting new rspec template
  • about 5 years Override for s:app_prepare_rails_command
  • over 5 years Shortcut support for ActionMailer Previews still pending?
  • over 5 years New views should be html.haml or html.erb
  • over 5 years Create files via affinity
  • over 6 years Projections: handling partial view names
  • about 8 years gf on :series looks for sery.rb
  • about 8 years "gf" from e.g. "t:('foo.bar.baz')" could jump to locale file
  • about 8 years Command (":Rlocales"?) to open locale files in splits
  • over 8 years Use inflections.rb to find the RModel
  • almost 9 years Extract string to locale file
vim-rails open pull requests (View All Pulls)
  • Fix for alternative spelling of plural (ices)
  • Add highlighting for 'submit' helper
  • adds flexibility to views location
  • update abbreviations to use Ruby 1.9 hash syntax
  • Add an option to use single quotes for partials
  • Add syntax highlighting support for new Rails 5 API, redirect_back
  • Expand syntax highlighting and path recognition for ActiveJob
  • A! method
  • Syntax highlight assert_empty and assert_not_empty
  • Highlight `assert_not_includes`
vim-rails questions on Stackoverflow (View All Questions)
  • How to override rails-projections for lib in vim-rails?
  • How to add <%= %> & variants in vim insert mode while using vim-rails and vim-surround?
  • How to get vim-rails' :Rake to run bin/rspec?
  • vim-rails: No such file or directory when doing Rserver
  • With Vim Rails, can you create a new migration file and open it in one go?
  • vim-rails switch off autocompletion
  • After installing vim-rails plugin I got problems with HAML indentation
  • How do I override gf with vim-rails
  • vim rails javascript_tag highlighting
vim-rails list of languages used
  • Vim script
Other projects in VimL