From 5dd40321e776b9fe2ae66efabcbc02d65cfceb5f Mon Sep 17 00:00:00 2001 From: hogelog Date: Fri, 12 Dec 2008 18:38:37 +0000 Subject: * add char-hints-mod2.js: char-hints-mod for vimperator 2.0pre. git-svn-id: http://svn.coderepos.org/share/lang/javascript/vimperator-plugins/trunk@26595 d0d07461-0603-4401-acd4-de1884942a52 --- char-hints-mod2.js | 121 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 121 insertions(+) create mode 100644 char-hints-mod2.js (limited to 'char-hints-mod2.js') diff --git a/char-hints-mod2.js b/char-hints-mod2.js new file mode 100644 index 0000000..c1bed58 --- /dev/null +++ b/char-hints-mod2.js @@ -0,0 +1,121 @@ +// PLUGIN_INFO//{{{ +var PLUGIN_INFO = + + {NAME} + character hint mode. + hogelog + 0.0.1 + 2.0pre + 2.0pre + select hint-matcher. +UpperCase => select char-hint. + +== OPTIONS == +set histchars="hjkl" => show char-hint use h, j, k, l. +let g:multi_requester_use_wedata = "false" // true by default + + ]]> +; +//}}} + +(function (){ + + const DEFAULT_HINTCHARS = "HJKLASDFGYUIOPQWERTNMZXCVB"; + + options.add(["hintchars", "hchar"], + "Hint characters", + "string", DEFAULT_HINTCHARS); + + function chars2num(chars) //{{{ + { + var num = 0; + var hintchars = options.hintchars.toUpperCase(); + var base = hintchars.length; + for(let i=0;i0); + + return chars; + } //}}} + function showCharHints() //{{{ + { + for (let elem in buffer.evaluateXPath("//*[@liberator:highlight and @number]", window.content.document)) + { + let num = elem.getAttribute("number"); + let hintchar = num2chars(parseInt(num, 10)); + elem.setAttribute("hintchar", hintchar); + } + } //}}} + + let hintContext = hints.addMode; + let charhints = plugins.charhints = { + show: function(minor, filter, win) //{{{ + { + charhints.original.show(minor, filter, win); + showCharHints(); + }, //}}} + onInput: function(event) //{{{ + { + let hintString = commandline.command; + commandline.command = hintString.replace(/[A-Z]/g, ""); + for(let i=0;i