(Show how to use elinks (or links) with the Netrw plugin) |
(Assign tip id + convert to TipNew template + minor clean) |
||
(2 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
+ | {{TipNew |
||
− | The VIM Netrw plugin allows one to view the contents of an http hyperlink via |
||
+ | |id=1596 |
||
− | <code>CTRL-W_CTRL-F</code>. Netrw checks the user's system (in this order) for |
||
+ | |previous=1595 |
||
− | <code>curl</code>, <code>wget</code>, and <code>fetch</code>. Text browsers |
||
+ | |next=1597 |
||
− | such as <code>elinks</code> and <code>links</code> are better alternatives to |
||
+ | |created=July 25, 2008 |
||
− | HTTP clients like <code>curl</code> because they have a <code>-dump</code> |
||
+ | |complexity=basic |
||
− | option which strips out the HTML tags and formats tables for improved ASCII |
||
+ | |author=Emallove |
||
− | viewing. Getting these text-based web browsers working with Netrw requires a simple |
||
+ | |version=7.0 |
||
− | wrapper script to format the arguments in the order that Netrw provides them: |
||
+ | |subpage=/200807 |
||
+ | |category1= |
||
+ | |category2= |
||
+ | }} |
||
+ | The Vim Netrw plugin allows one to view the contents of an http hyperlink via <code>CTRL-W_CTRL-F</code>. Netrw checks the user's system (in this order) for <code>curl</code>, <code>wget</code>, and <code>fetch</code>. Text browsers such as <code>elinks</code> and <code>links</code> are better alternatives to HTTP clients like <code>curl</code> because they have a <code>-dump</code> option which strips out the HTML tags and formats tables for improved ASCII viewing. Getting these text-based web browsers working with Netrw requires a simple wrapper script to format the arguments in the order that Netrw provides them: |
||
<pre> |
<pre> |
||
Line 12: | Line 17: | ||
</pre> |
</pre> |
||
− | Here is a sample wrapper script for <code>elinks</code> (named <code>elinks-for-vim</code>). |
+ | Here is a sample wrapper script for <code>elinks</code> (in a file named <code>elinks-for-vim</code>). |
− | |||
<pre> |
<pre> |
||
#!/bin/sh |
#!/bin/sh |
||
Line 21: | Line 25: | ||
</pre> |
</pre> |
||
− | Then, add this line to your |
+ | Then, add this line to your [[vimrc]]: |
− | |||
<pre> |
<pre> |
||
let g:netrw_http_cmd = "elinks-for-vim" |
let g:netrw_http_cmd = "elinks-for-vim" |
||
</pre> |
</pre> |
||
+ | |||
+ | ==See also== |
||
+ | *[[VimTip127|Preview HTML files quickly]] |
||
+ | |||
+ | ==Comments== |
Latest revision as of 09:16, 27 March 2009
Tip 1596 Printable Monobook Previous Next
created July 25, 2008 · complexity basic · author Emallove · version 7.0
The Vim Netrw plugin allows one to view the contents of an http hyperlink via CTRL-W_CTRL-F
. Netrw checks the user's system (in this order) for curl
, wget
, and fetch
. Text browsers such as elinks
and links
are better alternatives to HTTP clients like curl
because they have a -dump
option which strips out the HTML tags and formats tables for improved ASCII viewing. Getting these text-based web browsers working with Netrw requires a simple wrapper script to format the arguments in the order that Netrw provides them:
$ agent tempfile url
Here is a sample wrapper script for elinks
(in a file named elinks-for-vim
).
#!/bin/sh tempfile=`echo $* | awk '{print $1}'` url=`echo $* | awk '{print $2}'` elinks -dump $url > $tempfile
Then, add this line to your vimrc:
let g:netrw_http_cmd = "elinks-for-vim"