Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is there some program that can parse vim syntax highlighting scripts and colorize code for export to the shell? Basically I am looking for cat/less with shell highlighting that draws its syntax from vimscript definitions, so I can define my own.

addendum: A preferred solution would be a program that outputted to stdout directly, like cat, so i could pipe to less or whatever i would want to use it for

share|improve this question
I've never heard of something like that. But did you try {pygments]( – romainl Feb 19 '13 at 6:13
@romainl I did look at pygments, but there is support for customization in the matter I am looking for – Justin L. Feb 19 '13 at 19:01

For use as a pager, Vim comes with $VIMRUNTIME/macros/ See here on the Vim Tips Wiki. There's also a plugin alternative, vimpager, and you'll probably find more on the Web.

share|improve this answer
This is nice and I will probably be using it :) However it might be nice to have something that prints directly to stdout. – Justin L. Feb 19 '13 at 19:07

I answered a similar question on StackOverflow:

Matthew Wozniski wrote a script called that does this with Vim. His version is at I've made a few modifications to it (if memory serves, the modifications allowed it to run on my Mac OS X system; I know the substitution of /dev/fd/9 for /proc/self/fd/9 had that purpose); see my gist at

I believe both versions of the script have trouble with returning to default background color if Vim's highlighting changes the background.

share|improve this answer
Thank you for this, this is almost exactly what I was looking for :) Do you know if it's possible to have this work with stdin? – Justin L. Feb 19 '13 at 23:38

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .