Coder Social home page Coder Social logo

vim-rails's Introduction

rails.vim

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.

  • 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

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 git://github.com/tpope/vim-rails.git
git clone git://github.com/tpope/vim-bundler.git

You don't strictly need bundler.vim, but it helps.

Once help tags have been generated, you can view the manual with :help rails.

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 the :RT 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. 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's People

Contributors

a2ikm avatar akahn avatar aripollak avatar blueyed avatar bogdan avatar cassiomarques avatar ches avatar daniellesucher avatar dasch avatar dawidjanczak avatar duff avatar francocatena avatar graudeejs avatar graywh avatar hakanensari avatar ivalkeen avatar janko avatar jem avatar jlefley avatar jweslley avatar kalys avatar kelsin avatar mwilden avatar mwunsch avatar nerdrew avatar ngauthier avatar rainux avatar rsludge avatar tpope avatar tylerrick avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.