Here’s a way to simplify the number of keystrokes when viewing things from the web using Vim.
Previously, I was typing the following incantation whenever I wanted to view the source of a web-page from the command line:
$ curl <url> | view -
This works, but has some very minor drawbacks. One of them that I run into is that I occasionally forget to add the trailing dash, which usually results in a lot of noisy characters coming through as Vim tries to interpret the output.
Today, by accident, I simply typed the following:
$ view <url>
and it actually worked. The site was fetched using
curl in the background and the page opened up in Vim. It even opened with syntax highlighting as the page was downloaded to a temporary file first.
✍️ Reply by email