ANSI Color Codes in VIM

Blake picture Blake · May 15, 2012 · Viewed 22k times · Source

I have a script that generates a log file with ANSI color codes in them like so:

[2012-05-14 18:00:02] ^[[0mINF: -- Starting update script --^[[0m
[2012-05-14 18:00:29] ^[[91mERR: Improper date, entry being ignored.^[[0m

Is there any way to get Vim to understand these color codes?

Thanks for any help.

Answer

John Carter picture John Carter · May 15, 2012

I'm not sure about vim, but if you're just viewing a log file (ie you don't need to be able to edit) you could use less:

less -R