aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormitsugu oyama2010-10-25 20:05:11 +0900
committermitsugu oyama2010-10-25 20:05:11 +0900
commit55fdf6e143203a0cd0a500b02f457916e18a9fe3 (patch)
tree0042e56cbb0f5e5888988ddbdb216d93ead10b25
parente1442683f0e0590781b9570fe03ff221a4f74c4c (diff)
downloadvimperator-plugins-55fdf6e143203a0cd0a500b02f457916e18a9fe3.tar.bz2
add tohex.js
-rw-r--r--tohex.js39
1 files changed, 39 insertions, 0 deletions
diff --git a/tohex.js b/tohex.js
new file mode 100644
index 0000000..a75898d
--- /dev/null
+++ b/tohex.js
@@ -0,0 +1,39 @@
+// INFO //
+var INFO =
+<plugin name="tohex.js" version="0.1"
+ summary="tohex.js"
+ xmlns="http://vimperator.org/namespaces/liberator">
+ <author email="mitsugu.oyama@gmail.com">Mitsugu Oyama</author>
+ <license href="http://opensource.org/licenses/mit-license.php">MIT</license>
+ <project name="Vimperator" minVersion="2.3"/>
+ <p>Convert to hex code from string by this plugin.</p>
+ <item>
+ <tags>'tohex'</tags>
+ <spec>:tohex</spec>
+ <description>
+ <p>Convert to hex code from string by this plugin.</p>
+ <p>If you use <link topic="http://github.com/vimpr/vimperator-plugins/blob/master/i_love_echo.js">i_love_echo.js</link>, you should not use tohex plugin.
+ </description>
+ </item>
+</plugin>;
+
+commands.addUserCommand(
+ ['tohex'],
+ 'convert to hex code from charactor',
+ function(args){
+ if(1!=args.length){
+ liberator.echoerr('argument error');
+ return false;
+ }
+ let str='';
+ let max=args[0].length;
+ for(let i=0;i<max;i++)
+ str+=('\\u'+args[0].charCodeAt(i).toString(16));
+ liberator.echo(str);
+ util.copyToClipboard(str,true);
+ },
+ {
+ literal: false
+ },
+ true
+);