diff options
author | anekos | 2008-10-20 23:11:40 +0000 |
---|---|---|
committer | anekos | 2008-10-20 23:11:40 +0000 |
commit | 9e917bcb95710490186ff412beb51967d491a70b (patch) | |
tree | b46e54f0bd6a530235cea7edd2b8c4b27dd076b2 /asdfghjkl.js | |
parent | 2835a4f1089157a5df8603fd47f8eec3dfc3d8b3 (diff) | |
download | vimperator-plugins-9e917bcb95710490186ff412beb51967d491a70b.tar.bz2 |
Initial release: 指を伸ばすのがめんどくさい人向けプラグイン
git-svn-id: http://svn.coderepos.org/share/lang/javascript/vimperator-plugins/trunk@21757 d0d07461-0603-4401-acd4-de1884942a52
Diffstat (limited to 'asdfghjkl.js')
-rw-r--r-- | asdfghjkl.js | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/asdfghjkl.js b/asdfghjkl.js new file mode 100644 index 0000000..d585ceb --- /dev/null +++ b/asdfghjkl.js @@ -0,0 +1,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); + }; + +} |