Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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.

share|improve this question
add comment

2 Answers

up vote 3 down vote accepted

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.)

share|improve this answer
    
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 Jul 23 '12 at 11:23
    
unfortunately it does not support some escape codes, like high intensity foreground color! –  saeedn Jul 25 '12 at 11:39
add comment

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.

share|improve this answer
2  
You are talking about syntax highlighting, which is different from raw ANSI escape codes embedded in the text. –  jw013 Jul 23 '12 at 12:09
    
Oh yes, sorry, i seem to have read the question incorrectly, my mistake. –  Antonis Kalou Jul 23 '12 at 21:26
add comment

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.