// ==VimperatorPlugin== // @name Stat Stat // @description Show information on statusline. // @description-ja ステータスラインに情報を表示 // @license Creative Commons Attribution-Share Alike 3.0 Unported // @version 1.0 // @author anekos (anekos@snca.net) // @minVersion 2.0pre // @maxVersion 2.0pre // ==/VimperatorPlugin== // // Usage: // :statstat // // Usage-ja: // :statstat // // Links: // http://d.hatena.ne.jp/nokturnalmortum/20081202/1228218135 // License: // http://creativecommons.org/licenses/by-sa/3.0/ (function () { let stat = liberator.plugins.statstat; let defaultExpression = liberator.globalVariables.statstat_expression; let defaultInterval = liberator.globalVariables.statstat_interval; let autorun = s2b(liberator.globalVariables.statstat_autorun, false); function s2b (s, d) (!/^(\d+|false)$/i.test(s)|parseInt(s)|!!d*2)&1<'), action: function () new Date().toLocaleString(), execute: function () (this.text = this.action.apply(this, arguments)), run: function () { let self = this; Array.slice(arguments).forEach(function (v) { if (v instanceof Function) self.action = v; else if (typeof v == 'string') self.action = function () liberator.eval(v); else if (typeof v == 'number') self.interval = v; }); this.handle = setInterval(function () self.execute(), this.interval); }, handle: null }; } // set default if (defaultExpression) stat.action = e2a(defaultExpression); if (defaultInterval) stat.interval = parseInt(defaultInterval); if (autorun) stat.run(); commands.addUserCommand( ['statstat'], 'Run statstat', function (arg) { if (stat.handle) clearInterval(stat.handle); let interval = arg.count ? arg.count * 100 : 100; stat.action = e2a(arg.string); stat.handle = setInterval(function () stat.execute(), interval); }, { completer: function (context) completion.javascript(context), argCount: '*', count: true }, true ); })(); // vim:sw=2 ts=2 et si fdm=marker: ea40512e3'>root/plugin_loader.js
blob: 8b62c443c375d4425f86ada77ac2d0009c1c9c26 (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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105