diff options
author | anekos | 2011-07-04 00:09:49 +0900 |
---|---|---|
committer | anekos | 2011-07-04 00:09:49 +0900 |
commit | 0be4cbd03c6467daf4f21a3e37b23e3aadeec6a5 (patch) | |
tree | ee0dfe26bdec92cadd72b0aa33f39de086e66c67 /twittperator/add-url-completer.tw | |
parent | 867e46ea76e40f4da8c11bd67345a5876bdd3ac4 (diff) | |
download | vimperator-plugins-0be4cbd03c6467daf4f21a3e37b23e3aadeec6a5.tar.bz2 |
Twittperator の履歴から URL を取り出して、:tabopen などで補完できるようにする
Diffstat (limited to 'twittperator/add-url-completer.tw')
-rw-r--r-- | twittperator/add-url-completer.tw | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/twittperator/add-url-completer.tw b/twittperator/add-url-completer.tw new file mode 100644 index 0000000..694fa7a --- /dev/null +++ b/twittperator/add-url-completer.tw @@ -0,0 +1,63 @@ +/* NEW BSD LICENSE {{{ +Copyright (c) 2011, anekos. +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + 3. The names of the authors may not be used to endorse or promote products + derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, +INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF +THE POSSIBILITY OF SUCH DAMAGE. + + +################################################################################### +# http://sourceforge.jp/projects/opensource/wiki/licenses%2Fnew_BSD_license # +# に参考になる日本語訳がありますが、有効なのは上記英文となります。 # +################################################################################### + +}}} */ + +/* + * Please write the below line into .vimperatorrc. + * let g:twittperator_plugin_add_url_completer = 1 + * and, add "T" into "complete" option after vimperator boot. + */ + +(function () { + + completion.addUrlCompleter( + 'T', + 'Open the urls in tweets', + function (context, args) { + context.filters = [CompletionContext.Filter.textAndDescription]; + let cs = []; + for (let [, t] in Iterator(plugins.twittperator.Tweets)) { + if (!(t.entities && t.entities.urls)) + continue; + for (let [, u] in Iterator(t.entities.urls)) { + if (u.expanded_url) + cs.push([u.expanded_url, t.text]); + } + } + context.completions = cs; + } + ); + +})(); + +// vim: sw=2 ts=2 et fdm=marker ft=javascript: |