.vim/after/ftplugin/php.vim
nmap <F4> :execute 'Ref phpmanual ' . expand('<cword>') <CR>
.vim/ftplugin/ruby.vim
nnoremap <F4> :execute 'Ref refe ' . expand('<cword>') <CR>
expand('<cword>')
でカーソル上の単語が取れる。この関数をマッピングで使ううまいやり方わからなかったけど、これでとりあえずいけた。