Using rails-footnotes with vim/gVim
Update March 7, 2011: The rails-footnotes gem/plugin as of version 3.6.7 finally works with Rails 3 and Rails > 2.3.6, meaning the project has been revived in a great way. One less reason for shirking the upgrade to Rails 3 and newer versions of rails 2.3.
Few gems or plugins speed up Rails development like rails-footnotes by José Valim and others. Especially useful is its ability to open files directly in the a text editor from Firefox. Out of the box, this gem works with Textmate, but it's quite easy to get it to work with Netbeans. To apply the same process for Vim/gVim integration, proceed like so:
Change your configuration in environment.rb of your Rails project to, for example:
The protocol can be anything you like, this will now be configured in Firefox.
Open about:config in your Firefox location bar and Right-Click
New > String "network.protocol-handler.app.gvim" with content ~/.editor_gvim.rb Right-Click New > Boolean "network.protocol-handler.external.gvim" with value true
Update: In Firefox 3.5 and above you have to do: Right-Click: New > Boolean "network.protocol-handler.expose.gvim" with value false.
Then click on the link and select the ruby script that you created with the instructions below in the dialog. You can manage the assigned program in Edit > Preferences > Applications.
Create a script, for example in you home directory, and don't forget to make it executable:
The script could look like so:
The last two lines are delimited by backticks and it's two hyphens (- -) before remote-tab-silent, which might all get eaten by Wordpress, so be sure to adjust after copying and pasting the code above. Install wmctrl
The command in the script above
will open each file in a new tab. If you want every file in a new buffer, simply change it to
Finally, nothing stops you from opening the file in gVim and Netbeans simultaneously just by adding
NB will usually pick up all the changes automatically but in gVim you'll have to reload with :e! The Vim/gVim startup options are not easy to fathom (options go before files etc.), but here is the the documentation. Update for RubyMine: The relevant line to open RubyMine in your executable .rb file is the same as the new command line option to open a file on a specific line in RubyMine (from Version 3.2):
This requires that you have created a Command-line launcher (under FIle > Create Command-line launcher). Update: Here's a version which also sets the current vim directory (check with :pwd) to your rails root (prevents overwhelming fuzzy finder):
With these settings in environment.rb:
Now with the Vimperator plugin for Firefox you have round-trip development with gVim and Firefox without touching the mouse. Hope it helps.
Posted: 28 April 2010