Ruby Documentation in Neovim
I was enjoying this lovely plugin, but it stopped working.
After wasting some time on it, I decided to write the same functionality on my own.
"*****************************************************************************
"" vim-ruby-doc
"*****************************************************************************
" For some reason this plugin doesn't work anymore,
" so I hacked together the same functionality, using its example.
" Replace 'firefox' with whatever command you need instead.
let g:ruby_doc_url_template="http://rubydoc.info/search/stdlib/core?q=%"
let g:rails_doc_url_template="http://api.rubyonrails.org/?q=%"
let g:rspec_doc_url_template='https://www.relishapp.com/rspec/search?query=%'
function! AnyRDoc(url_template)
if &ft =~ "ruby"
else
return
endif
let s:wordUnderCursor = expand("<cword>")
let s:url = substitute(a:url_template, "%", s:wordUnderCursor, "g")
let s:cmd = "!firefox \"" . s:url . "\""
execute s:cmd
endfunction
map RB :call AnyRDoc(ruby_doc_url_template)<CR>
map RR :call AnyRDoc(rails_doc_url_template)<CR>
map RS :call AnyRDoc(rspec_doc_url_template)<CR>
Published on 18 Apr 2020
all tags
100daysofcode activerecord android annoyances api apt arch array artix atom az3w backend bash blog browser bug callback career ci-cd cli cloud code coding config configuration cp crud cryptography css csv database db design devops django docker email erp feelsgood filter fugitive gif gist git gnome gnome pomodoro grep hebrew http ide isbn-fetcher iso javascript job search js kanban kindle koans learning linkedin linux logger manjaro map markdown microservices mobi mtp neovim nodejs nvchad packages panda pastbin patch portfolio post postgres pytest python rails reduce refactoring reflections rest routes rspec ruby salesforce script scripting security sed shell sql string_replacement study tdd terminal testing tmux ttd version_control vim vim sort walkthrough webdev workflow zsh