I recently discovered ZenCoding.vim. It includes a nice feature for building an html anchor from an url; the anchor text is being directly retrieved from the web, specifically the <title> tag of the web page:
Say your file contains a line
http://www.amazon.com
If you position the cursor on the url and press (Crtl Y + a), ZenCoding transforms it into
<a href="http://www.amazon.com">Amazon.com: Online Shopping for Electronics, Apparel, Computers, Books, DVDs & more</a>
Unfortunately, this feature relies on curl for retrieving information from the web. I use wget instead (for no reason, I just happen to know this tools and it suffices for my modest needs).
In order to get ZenCoding to work with wget you have to change two lines of code as follows:
"silent! exec '0r!curl -s -L "'.substitute(a:url, '#.*', '', '').'"'
silent! exec '0r!wget -q -O - "'.substitute(a:url, '#.*', '', '').'"'
and
"let hex = substitute(system('curl -s "'.fn.'" | xxd -p'), '\n', '', 'g')
let hex = substitute(system('wget -q -O - "'.fn.'" | xxd -p'), '\n', '', 'g')
At least this is what GNU wget running on Windows + Cygwin expects.
0 comentaris:
Publica un comentari