blob: 4218e096c18f407dbd95135a74280ce7a8bde1ef (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
// ==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.0
// @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; モード(?)に入ります。
// 出たい場合は、もう一度押します。
//
// Links:
// http://d.hatena.ne.jp/nokturnalmortum/20081021#1224543467
//
{
let asdfghjkl_default = 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);
};
}
|