I'm trying to view and edit a file in Vim, but this file has ANSI escape codes:

^[[1m[0.05s elapsed, 00:00:13 total]^[[0m

How can I tell Vim to interpret them properly instead of just showing the raw code?


It sounds like you want to display ANSI colors and conceal their escape characters. You can do this with Charles Campbell's "AnsiEsc" plugin.

Note that you will need Vim version 7.3 or newer. (Older versions of Vim could be patched, but that's more work for an outdated version of Vim.)

| improve this answer | |
  • This works, if the file is in a buffer. However it doesn't work great if you are running a command like rake or cucumber that puts the command output not in a buffer. – Ivan Jan 30 '12 at 5:50
  • That is correct, but the asker specifically mentioned ANSI within a file opened in Vim. – Heptite Jan 30 '12 at 6:51

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.