I’m writing a book. I have a large notes file, with hyperlinks of interest. I’d like to be able to move the cursor over a hyperlink, execute a command, and have the text of the webpage inserted for reading, cutting, and modifying. Ideally, it would only be the readable text rather than the full HTML, but I’ll take what I can get (or what I can wget, if that’s the right shell function).
Surely such a thing has already been put together, but searches for “vim insert text hyperlink” and such are not very helpful. Have you seen this function?
With your mouse cursor on a hyperlink, execute
This will insert the raw contents on the following line.
To preprocess:
Of course, you can map this to a key:
Various notes:
If you have quoted urls, you might not be happy about C-rC-a because the quotes will get included. Consider doing
And use C-rC-w instead. Alternatively,
allows you to use C-rC-f instead.
If you don’t want to tinker with any of your settings, consider creating a function that saves and restores the value of
&iskeywordor&isfname. To bring out the big gun, write a regex for URLs and use that: