*live* vim syntax highlighting on stdout?

3

3

I want to have some program's output colorized as it apperas on terminal.

I know that utility named highlight does the this. But: it has a limited set of built-in language support, and I want coloring for e.g. some work-related daemon logs, for which I already made complex vim syntax files.

I know it is possible to use vim for syntax highlighting as less replacement (vimpager) or directly in terminal (vimcat). But, both these ways vim waits until EOF, and then display colored file -- it's useless for e.g. live daemon testing.

So: is it possible to use vim's syntax highlighting in "live mode"? Or maybe is there an automatic converter from vim's syntax files to highlight's language definitions?

quezak

Posted 2013-11-15T17:21:31.810

Reputation: 213

Answers

0

maybe this (http://www.vim.org/scripts/script.php?script%5Fid=1714) could be a solution for you

use vim like tail

konqui

Posted 2013-11-15T17:21:31.810

Reputation: 504

it's not perfect, but it may do the thing after a bit of tweaking (getting rid of vim's window as in vimcat, shortening updatetime for this mode). Thanks. – quezak – 2013-11-15T19:02:43.047

found another thread about this http://superuser.com/questions/117841/get-colors-in-less-command maybe you find something better there

– konqui – 2013-11-24T12:16:07.450

pygmentize is nice, but there's the same issue as with highlight -- i'd have to write my own syntax file. Since there was no way to simply use my vim syntax file, I ended up writing a bash script with a bunch of sed-ing imitating most important aspects of the mentioned vim syntax file to color piped output from my programs. – quezak – 2013-11-27T12:58:31.777