Ansi Escape Code – Ansi Escape Code in VIM

terminalvim

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.

Best Answer

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

Related Question