How to highlight logs with bash coloring on vim

colorsvim

I have some nicely colored logs from some tools with bash color codes. When I view them through less or similar tools it get color rendered by bash (obviously).
However it is pain to watch and edit them in any text editor like vim, because Ansi escape sequences that describes colors gets mangled and becomes really annoying to select edit, cut, paste, etc. etc..

I have ugly stuff like this when watched by vim or any editor:

0:00:00.001474526 ^[[334m11931^[[00m      0x21df400 ^[[36mDEBUG  ^[[00m ^[[00m       

So:

  1. Is there anything like plugin for vim to color text according these bash color descriptors. Anything like that. If Vim could highlight text according Ansi escape sequences for more pleasant viewing.
  2. If above is impossible how to pipe log through something and have colorless output feed to vim for it to be at least editable.

Best Answer

You're looking for the AnsiEsc.vim - ansi escape sequences concealed, but highlighted plugin; it uses the conceal feature to hide the ANSI escape codes, and defines syntax groups to color the text inside Vim.

screenshot

Related Question