In Linux bash shell, we can put colors with something like this:

Let's imagine a file color.txt with contents

\e[0;31m blah blah \e[0

If we do 'cat color.txt', it will results in

blah blah (red color)

But, if we open up color.txt in vim, it will just show the origin text. What I want is vim displaying colored text as 'cat color.txt' do. Is there an option for this in vim?


As described elsewhere, you can use this vim script to conceal the escape codes and format the text via syntax highlighting.

Install it by downloading AnsiEsc.vba.gz version 12 from the bottom of the linked page, ungzip, open it in vim, run :source % in command mode.

  • I've done :source % and looks like the script is installed properly. But I still don't see the color in vim. Just Escape characters as plain text. Is there some key-code to initialize the coloring? – jaeyong Jul 21 '14 at 10:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.