Skip to content

Instantly share code, notes, and snippets.

@marceldegraaf
Created July 14, 2010 11:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save marceldegraaf/475310 to your computer and use it in GitHub Desktop.
Save marceldegraaf/475310 to your computer and use it in GitHub Desktop.
"
" APIdock search for word under cursor
"
let g:browser = 'open -a /Applications/Google\ Chrome.app '
" On OSX - let g:browser = 'open -a /Applications/Firefox.app'
" Open the Ruby ApiDock page for the word under cursor, in a new Firefox tab
function! OpenRubyDoc(keyword)
let url = 'http://apidock.com/ruby/search/quick?query='.a:keyword
exec '!'.g:browser.' '.url.' &'
endfunction
noremap RB :call OpenRubyDoc(expand('<cword>'))<CR>
" Open the Rails ApiDock page for the word under cursor, in a new Firefox tab
function! OpenRailsDoc(keyword)
let url = 'http://apidock.com/rails/search/quick?query='.a:keyword
exec '!'.g:browser.' '.url.' &'
endfunction
noremap RR :call OpenRailsDoc(expand('<cword>'))<CR>
" Open the Rspec ApiDock page for the word under cursor, in a new Firefox tab
function! OpenRspecDoc(keyword)
let url = 'http://apidock.com/rspec/search/quick?query='.a:keyword
exec '!'.g:browser.' '.url.' &'
endfunction
noremap RS :call OpenRspecDoc(expand('<cword>'))<CR>
function! RemoveTrailingWhiteSpaces()
" Remove ALL trailing whitespaces
%s/\s\+$//
endfunction
noremap WW :call RemoveTrailingWhiteSpaces()<CR>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment