Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I feel that the `highlight' utility doesn't support as many file types as vim does, and the project isn't very active. When the file is gzipped, highlight doesn't recognize it at all.

But in despite of `highlight', as an alternative choice, can I have the colorized vim text output to the console?

share|improve this question

2 Answers 2

up vote 1 down vote accepted

If you insist on using vim for this you can disable clearing of the screen on exit with :set t_ti= t_te=.

To make this behave a little more light highlight you can automatically exit vim. This will however only show you one screen of higlighted source. Additionally you would need to :redraw the screen to actually see something.

Also use the view alias of vim to open the file read-only.

$ view --cmd "set t_ti= t_te=" "+redraw" "+q" YOUR_FILE

A way more natural solution would pygmentize from the pygments python package.

share|improve this answer
    
Well, the usage only gives one screen, but at least it gives one screen. What I want is to utilize the highlight function of vim, maybe I have to hack into the source code. –  Xiè Jìléi Aug 2 '10 at 12:18

vim can act as a replacement for less, while adding features such as vim's syntax highlighting, by running /usr/share/vim/vimcurrent/macros/less.sh.

I haven't used highlight, so I'm not sure if this is what you're looking for or not.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.