aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoranekos2010-05-16 15:47:02 +0000
committeranekos2010-05-16 15:47:02 +0000
commit8175622949aa46df7be67df4904076f70b3684a6 (patch)
treefdbd3e5fa68f80349065d97382323d7e40317dcb
parent7bf21c3ee362e193e7af5e288634eec3b81ce5b0 (diff)
downloadvimperator-plugins-8175622949aa46df7be67df4904076f70b3684a6.tar.bz2
各モードに対応
git-svn-id: http://svn.coderepos.org/share/lang/javascript/vimperator-plugins/trunk@37589 d0d07461-0603-4401-acd4-de1884942a52
-rw-r--r--yetmappings.js38
1 files changed, 24 insertions, 14 deletions
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 =
<name>Yet Mappings</name>
<description>Display the keys that are not mapped yet.</description>
<description lang="ja">まだマップされていないキーを表示する</description>
- <version>1.1.0</version>
+ <version>1.2.0</version>
<author mail="anekos@snca.net" homepage="http://d.hatena.ne.jp/nokturnalmortum/">anekos</author>
<license>new BSD License (Please read the source code comments of this plugin)</license>
<license lang="ja">修正BSDライセンス (ソースコードのコメントを参照してください)</license>
@@ -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'],