Vim Brush For SyntaxHighlighter

 

SyntaxHighlighter is awesome but there is no builtin Vim "brush" as they call their files which match a syntax. At first I tried to hack it by adding "vim" as an alias to the Bash brush but that only caught a few keywords at most and since I've been posting a lot of Vim snippets lately I figured I'd take 5 minutes and make my own.

This only covers the core Vim keywords and commands anything that was directly related to a plugin or extension you must add yourself which is pretty easy by following this process:

  • Copy the keywords from the .vim file in the /usr/share/vim*/syntax directory
  • Remove everything but the keywords themselves
  • Replace all of the bracketed keywords with their short AND long versions
    • :%s/\v(\w+)\[([^\]]+)\] / \1 \1\2 /g
  • :set textwidth=80
  • Go to the end of the string and hit any non-whitespace key, Vim should automatically wrap the string to 80 characters, delete the key you just pressed
  • :%s/^/'/g
  • :%s/$/' +/g
  • Delete the extra + at the end
  • Copy and paste it into the "var keywords" string in the shBrushVim.js file