From ef9737282f88cafb6ebcc1c9838ef8220cf2b732 Mon Sep 17 00:00:00 2001 From: anekos Date: Tue, 2 Mar 2010 18:32:38 +0000 Subject: fmap でリスト出力 git-svn-id: http://svn.coderepos.org/share/lang/javascript/vimperator-plugins/trunk@36906 d0d07461-0603-4401-acd4-de1884942a52 --- feedSomeKeys_3.js | 49 +++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 45 insertions(+), 4 deletions(-) (limited to 'feedSomeKeys_3.js') diff --git a/feedSomeKeys_3.js b/feedSomeKeys_3.js index 259481b..6cd5b8b 100755 --- a/feedSomeKeys_3.js +++ b/feedSomeKeys_3.js @@ -39,7 +39,7 @@ let PLUGIN_INFO = feedSomeKeys 3 feed some defined key events into the Web content キーイベントをWebコンテンツ側に送る - 1.1.0 + 1.2.0 anekos new BSD License (Please read the source code comments of this plugin) 修正BSDライセンス (ソースコードのコメントを参照してください) @@ -79,7 +79,7 @@ lazy fmaps -u='http://code.google.com/p/vimperator-labs/issues/detail' u // }}} // INFO {{{ let INFO = - @@ -277,6 +277,40 @@ let INFO = function (values) (values && !values.some(function (value) !list.some(function (event) event === value))); + function list (filter) { + if (filter) + filter = mappings._expandLeader(filter); + + liberator.log(filter); + + let maps = [ + map + for (map in mappings._mappingsIterator([modes.NORMAL], mappings._user)) + if (map.feedSomeKeys && (!filter || map.names[0] == filter)) + ]; + + let template = modules.template; + let list = + + { + template.map(maps, function (map) + template.map(map.names, function (name) + + + + + )) + } +
{name}{map.feedSomeKeys.rhs}{map.matchingUrls ? map.matchingUrls : '[Global]'}
; + + // TODO: Move this to an ItemList to show this automatically + if (list.*.length() == list.text().length()) { + liberator.echomsg("No mapping found"); + return; + } + commandline.echo(list, commandline.HL_NORMAL, commandline.FORCE_MULTILINE); + } + 'fmap fmaps'.split(/\s+/).forEach(function (cmd) { let multi = cmd === 'fmaps'; @@ -307,7 +341,10 @@ let INFO = feed(rhs, args['-events'] || ['keypress'], elem); }, { - matchingUrls: args['-urls'] + matchingUrls: args['-urls'], + feedSomeKeys: { + rhs: rhs + } }, true ); @@ -318,7 +355,11 @@ let INFO = args.literalArg.split(/\s+/).map(String.trim).map(sep).forEach(add); } else { let [, lhs, rhs] = args.literalArg.match(/^(\S+)\s+(.*)$/) || args.literalArg; - add([lhs, rhs]); + if (!rhs) { + list(args.literalArg.trim()); + } else { + add([lhs, rhs]); + } } }; } -- cgit v1.2.3