Vim Tips Wiki

Using elinks with netrw

Revision as of 09:34, March 26, 2009 by JohnBeckett (Talk | contribs)

1,619pages on
this wiki

Proposed tip Please edit this page to improve it, or add your comments below (do not use the discussion page).

Please use new tips to discuss whether this page should be a permanent tip, or whether it should be merged to an existing tip.
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).

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"

See also


Around Wikia's network

Random Wiki