aboutsummaryrefslogtreecommitdiffstats
path: root/asdfghjkl.js
diff options
context:
space:
mode:
authoranekos2008-11-08 16:35:49 +0000
committeranekos2008-11-08 16:35:49 +0000
commit05494c71f1a1e8b06cb4b7e7815c61524725ff4c (patch)
tree300430684a24fc26facdcae09fd05b4423328bf6 /asdfghjkl.js
parent5b829e24b4aae22f34799e7ce359952aac60b93a (diff)
downloadvimperator-plugins-05494c71f1a1e8b06cb4b7e7815c61524725ff4c.tar.bz2
added
git-svn-id: http://svn.coderepos.org/share/lang/javascript/vimperator-plugins/branches/1.2@23016 d0d07461-0603-4401-acd4-de1884942a52
Diffstat (limited to 'asdfghjkl.js')
-rw-r--r--asdfghjkl.js58
1 files changed, 58 insertions, 0 deletions
diff --git a/asdfghjkl.js b/asdfghjkl.js
new file mode 100644
index 0000000..87f960d
--- /dev/null
+++ b/asdfghjkl.js
@@ -0,0 +1,58 @@
+// ==VimperatorPlugin==
+// @name asdfghjkl;
+// @description Inputting numbers by asdfghjkl; keys in hint mode.
+// @description-ja Hintモードで、asdfghjkl;キーを使って数字入力をする。
+// @license Creative Commons 2.1 (Attribution + Share Alike)
+// @version 1.1
+// @minVersion 1.2
+// @maxVersion 1.2
+// @author anekos (anekos@snca.net)
+// ==/VimperatorPlugin==
+//
+// Usage:
+// In hint-mode, When press <Space>, enter into asdfghjkl; mode.
+// (If you want to leave this mode, re-press <Space>)
+//
+// Usage-ja:
+// ヒントモードで、<Space> を押すと asdfghjkl; モード(?)に入ります。
+// 出たい場合は、もう一度押します。
+//
+// 切り替えキーを変更したい場合は、以下のように設定できます。
+// let g:asdfghjkl_mode_change_key = "<C-c>"
+//
+//
+// Links:
+// http://d.hatena.ne.jp/nokturnalmortum/20081021#1224543467
+//
+
+{
+ let asdfghjkl_default = window.eval(liberator.globalVariables.asdfghjkl_default || "false");
+ let active = false;
+
+ let original = {
+ show: hints.show,
+ onEvent: hints.onEvent,
+ };
+
+ hints.show = function () {
+ active = asdfghjkl_default;
+ return original.show.apply(this, arguments);
+ };
+
+ hints.onEvent = function (event) {
+ let key = events.toString(event);
+ if (key == "<Space>") {
+ active = !active;
+ return;
+ }
+ if (active && key.length == 1) {
+ let n = ";asdfghjkl".indexOf(key);
+ if (n >= 0) {
+ events.feedkeys(n.toString(), true);
+ return;
+ }
+ }
+ return original.onEvent.call(this, event);
+ };
+
+}