I have quite a lot of Perl scripts which print colored output to the terminal, using Term::ANSIColor. This is the same as when a shell script does e.g.

echo -e '\e[1;31mError:\e[0m Your fault.'

Viewing log files of these commands works in less (with the -R switch), but in Vim, the color characters are displayed raw like this:

^[[1;31mError:^[[0m Your fault.

I would do a syntax file to match these markers, conceal them, and color the resulting syntax regions accordingly, but first I wanted to check whether there is something like this already.

  • 2
    ... And it's very difficult to Google for that topic. Every query that includes "vim" and "colors" brings up hundreds of color schemes, which is not what I want. – Stefan Majewsky Sep 12 '12 at 11:56
  • vim ansi color is quite helpful, though. – Sven Sep 12 '12 at 12:09

Have a look into this plugin, it's likely what you want:

AnsiEsc.vim : ansi escape sequences concealed, but highlighted as specified

| improve this answer | |

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.