LoginSignup
27
25

More than 5 years have passed since last update.

curlからvimにパイプする

Posted at

たとえば、 curlコマンドでXMLをダウンロードしてvimで開きたい なんていう要望がAPI開発とかしてると湧いて出てくるんですが、これを可能にするワンライナー紹介します。

$ curl "http://b.hatena.ne.jp/search/tag?q=%E3%83%8F%E3%82%A6%E3%82%B9&mode=rss" | vim -

これで一発です。
キモはパイプ後のvimコマンドの後ろの - (ハイフン)です。これがないとダメです。

API側がちゃんとMIMETYPEをこさえていれば、それを読み取ってvimさんがfiletypeをセットしてハイライトしてくれます。地味に良い。

27
25
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
27
25