titleAndGoo.gl

.vimperatorrcをOS再インストール時に忘れてきたので、
わざわざ書くことでもないけど備忘のために。
"
vimperator の copy.js で短縮 URL を取得できるようにした - ess sup
http://goo.gl/pCoa
"

で紹介されているものに、
ページタイトル+goo.gl短縮でコピーできるように追加してみた。
といってもbufferからtitle引っ張ってきて
文字列くっつけただけ。

{ label: 'titleAndGoo.gl', value: 'get title and goo.gl short url',
         custom: function() { 
           var ret = "";
           var xhr = util.httpGet("http://ggl-shortener.appspot.com/?url=" + encodeURIComponent(buffer.URL));
           if (xhr && xhr.status === 200) {
              ret = JSON.parse(xhr.responseText).short_url;
           }
           return buffer.title + " " + ret;
         }
}

vimp側で追加表示したり扱いたいときは
echoコマンドで"buffer."とかタイプして、
後はtab補完で調べられるからなんて楽な作業。