From 8175622949aa46df7be67df4904076f70b3684a6 Mon Sep 17 00:00:00 2001 From: anekos Date: Sun, 16 May 2010 15:47:02 +0000 Subject: 各モードに対応 git-svn-id: http://svn.coderepos.org/share/lang/javascript/vimperator-plugins/trunk@37589 d0d07461-0603-4401-acd4-de1884942a52 --- yetmappings.js | 38 ++++++++++++++++++++++++-------------- 1 file changed, 24 insertions(+), 14 deletions(-) (limited to 'yetmappings.js') diff --git a/yetmappings.js b/yetmappings.js index d441e1c..d98fad2 100644 --- a/yetmappings.js +++ b/yetmappings.js @@ -38,7 +38,7 @@ let PLUGIN_INFO = Yet Mappings Display the keys that are not mapped yet. まだマップされていないキーを表示する - 1.1.0 + 1.2.0 anekos new BSD License (Please read the source code comments of this plugin) 修正BSDライセンス (ソースコードのコメントを参照してください) @@ -67,20 +67,30 @@ let PLUGIN_INFO = function exists (modes, key) (mappings.getCandidates(modes, key).length || mappings.get(modes, key)); - function getYetMappings (pre) - keys.filter(function (key) (!exists([modes.NORMAL], pre + key))); + function getYetMappings (pre, modes) + keys.filter(function (key) (!exists(modes, pre + key))); - commands.addUserCommand( - ['yetmap[pings]', 'ymap'], - 'display the keys that are not mapped yet.', - function (arg) { - liberator.echo(getYetMappings(arg.string || '').join(' ')); - }, - { - argCount: '*' - }, - true - ); + + function addCommand (char, modes) { + commands.addUserCommand( + [char + 'yetmap[pings]', char + 'ymap'], + 'display the keys that are not mapped yet.', + function (arg) { + liberator.echo(getYetMappings(arg.string || '', modes).join(' ')); + }, + { + argCount: '*' + }, + true + ); + } + + for (let [name, mode] in Iterator(modes._modeMap)) { + if (!mode.char) + continue; + addCommand(mode.char, [modes[name]]); + } + addCommand('', [modes.NORMAL]); commands.addUserCommand( ['yethintmodes', 'ymode'], -- cgit v1.2.3