6

I have a log file with colored log entries, where colors are defined by ansi escape codes. When I display the file (using cat or more), terminal understands the ansi codes and logs are colorful. But I want the power of VIM to do some text manipulation on log entries and yet see them colorful. Is there any plugin that can parse ansi codes in vim and color the text?

The only plugins I found were able to strip the ansi codes and show the plain text monochrome.

2 Answers 2

6

Yes: AnsiEsc.vim — ansi escape sequences concealed, but highlighted as specified (conceal), by Charles Campbell.

The "v2" version at the bottom doesn't require a patch to vim, so is probably the simplest option.

(The patch is necessary to hide the ANSI control characters in the text file.)

2
  • Thanks, it works. I used the v2 version and Text is colored. Maybe I use another script to suppress the ANSI characters (if I don't want to use the conceal patch).
    – saeedn
    Commented Jul 23, 2012 at 11:23
  • unfortunately it does not support some escape codes, like high intensity foreground color!
    – saeedn
    Commented Jul 25, 2012 at 11:39
-1

The log files should be colored in Vim, i dont have a problem with that, are you sure your files have the right extension. For instance program.c will show C style formatting and colors.

Antonis Kalou.

2
  • 2
    You are talking about syntax highlighting, which is different from raw ANSI escape codes embedded in the text.
    – jw013
    Commented Jul 23, 2012 at 12:09
  • 1
    Oh yes, sorry, i seem to have read the question incorrectly, my mistake. Commented Jul 23, 2012 at 21:26

You must log in to answer this question.

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