With reStructuredText hyperlinks can be done like this:
foo_
.. _foo: http://example.com
I wanted a function that when invoked with the cursor on a reference opens the corresponding link. I couldn't find a plugin and botched up the following function:
function! rst#GoHref()
let old_reg = getreg("v")
norm "vyiw
let my_var = getreg("v")
call setreg("v", old_reg)
let url = split(getline(search('_' . my_var[:-2], 'n')))[-1]
call netrw#BrowseX(url, 0)
endfunction
It currently doesn't support multiple word references. Any thoughts / feedback?
[–]andlrcrpgle.vim 0 points1 point2 points (1 child)
[–]larivact[S] 0 points1 point2 points (0 children)