blob: d585ceb1935a5c93f58ab5ad2436889593f8e511 (
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$B%b!<%I$G!"(Basdfghjkl;$B%-!<$r;H$C$F?t;zF~NO$r$9$k!#(B
// @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:
// $B%R%s%H%b!<%I$G!"(B<Space> $B$r2!$9$H(B asdfghjkl; $B%b!<%I(B(?)$B$KF~$j$^$9!#(B
// $B=P$?$$>l9g$O!"$b$&0lEY2!$7$^$9!#(B
//
// 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);
};
}
|