Skip to content

Latest commit

 

History

History
50 lines (29 loc) · 2.43 KB

README.md

File metadata and controls

50 lines (29 loc) · 2.43 KB

apidock.vim

This plugin allows you to browse APIdock's Ruby, Rails, and RSpec docs from within Vim. It will invoke Firefox from the command line, and open the query in a new tab.

The plugin uses the command 'firefox', which it expects to be in your path, and executable from your shell. See 'Customization' below if you need some other behavior. (In particular, all of you OSX users will have to make a small change.) This should work out of the box on Ubuntu, and most other Linux-based systems on which Firefox is installed.

The Official Version of ack.vim is available at vim.org.

Installation

If you have Rake installed, you can just run: rake install.

The file apidock.vim goes in ~/.vim/plugin, and the apidock.txt file belongs in ~/.vim/doc. Be sure to run

:helptags ~/.vim/doc

afterwards.

Usage

  • RR - Search the Rails docs for the word under the cursor.

  • RB - Search the Ruby docs for the word under the cursor.

  • RS - Search the RSpec docs for the word under the cursor.

Origin Story

This Vim plugin is mostly copied from the AkitaOnRails guys' vimfiles on GitHub. In particular, this commit by Cassio Marques on January 10th, 2009. I just added the RSpec function, the help docs, and then threw it up on GitHub. However, do bug me if something isn't working.

Customization

If you don't want to use Firefox, the fix is pretty simple. Edit ~/.vim/plugin/apidock.vim, and edit the line (should be line #1),


  let g:browser = 'firefox -new-tab '

using the shell command for your preferred browser.

In OSX, you'll want to change the previously mentioned line to


  let g:browser = 'open -a /Applications/Firefox.app'

You may also need to remove the three ampersands in the file. Davey did, anyway, as it wouldn't work with them. I have no idea why. Perhaps the 'open' command has problems with running asynchronously. Maybe the ampersand insulted its mother. Simply deleting the ampersand character will do, but you are welcome to remove everything after (and including) the final period from each line with an ampersand, if you'd like.