Tim Pope’s rails.vim plugin is essential…Also, one more vim hint

29Sep06

By Josh Adams.

First: Tim Pope released a Rails plugin for vim that you can get right here. Kevin showed it to me today, and it took roughly 25 seconds to install (just unzip it into ~/.vim if you’re running *NIX).

Second, and relatedly: In vim, “Ctrl-6” will function as a ‘back’ button for things like the ‘gf’ command, for instance. This is very useful once using Tim’s plugin.

Tim’s plugin lets you do some great things like:

  • Easily switch between model and test (use “:A”, for alternate file)
  • Easily switch between related files (for instance, “:Runittest foo” will open up the test/unit/foo.rb file. If you’re already in that file, then “:Rmodel” will take you to that model. This is exactly like the “:A” functionality above, but you can also do things like “:Rcontroller”, “:Rmigration”, etc.
  • You can use “gf” to easily navigate through your codebase. For instance, placing the cursor atop the string “HeyMacarena” would take you to the definition (either in /lib or in /app/model or in /app/controller, wherever…it’ll find it) for that class. Similarly, if you place your cursor over the symbol in, say “belongs_to :bar”, then the Bar model file is opened.
  • “:Rgenerate model foo” will call ‘script/generate model foo’ and then place you inside of app/models/foo.rb

These are just a few of the nice features. You can find out more in ~/.vim/doc/rails.txt after installing the plugin.

powered by performancing firefox

Advertisements


One Response to “Tim Pope’s rails.vim plugin is essential…Also, one more vim hint”

  1. Be not fuming that you cannot get others as you predisposition them to be, since you cannot make tracks yourself as you thirst to be


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


%d bloggers like this: