Created
January 5, 2012 17:41
-
-
Save hail2u/1566304 to your computer and use it in GitHub Desktop.
Vim script language handler for google code prettify
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Copyright (C) 2012 Kyo Nagashima | |
// | |
// LICENSE: http://hail2u.mit-license.org/2012 | |
/** | |
* @fileoverview | |
* Registers a language handler for Vim script. | |
* | |
* | |
* To use, include prettify.js and this file in your HTML page. | |
* Then put your code in an HTML tag like | |
* <pre class="prettyprint lang-vim"></pre> | |
* | |
* | |
* @author kyo@haiil2u.net | |
*/ | |
PR['registerLangHandler']( | |
PR['createSimpleLexer']( | |
[ | |
// White spaces | |
[PR['PR_PLAIN'], /^[ \t\r\n\f]+/, null, ' \t\r\n\f'] | |
], | |
[ | |
// Double quoted strings | |
[PR['PR_STRING'], /^\"(?:[^\n\r\f\\\"]|\\(?:\r\n?|\n|\f)|\\[\s\S])*\"/, null], | |
// Single quoted strings | |
[PR['PR_STRING'], /^\'(?:[^\n\r\f\\\']|\\(?:\r\n?|\n|\f)|\\[\s\S])*\'/, null], | |
// Commands | |
[PR['PR_KEYWORD'], /^(?:function|endfunction|delfunction|return|call|let|unlet|lockvar|unlockvar|if|endif|else|elseif|while|endwhile|for|in|endfor|continue|break|try|endtry|catch|finally|throw|echo|ehon|echohl|echomsg|echoerr|execute)\b/i, null], | |
// Line comment | |
[PR['PR_COMMENT'], /^\"[^\r\n]*/, null], | |
// Punctuations | |
[PR['PR_PUNCTUATION'], /^[^\s\w\'\"]+/] | |
]), | |
['vim']); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
cool thx!