Skip to content

Instantly share code, notes, and snippets.

@hail2u
Created January 5, 2012 17:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hail2u/1566304 to your computer and use it in GitHub Desktop.
Save hail2u/1566304 to your computer and use it in GitHub Desktop.
Vim script language handler for google code prettify
// 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']);
@dciccale
Copy link

dciccale commented Oct 7, 2013

cool thx!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment