Search code examples
vimmacvimansi-escape

VIM Unix commands printed in color


I'm using MacVim and I would like to have ! commands printed in color. For example:

In bash, the following echo statement prints Hello World in green (as expected):

$ echo -e "\033[32m Hello World" 
 Hello World

However, in VIM the output is not color, and the escape codes are printed:

:!echo -e "\033[32m Hello World" 
 [32m Hello World

How can one have VIM (and MacVim build 57 in particular) print the output of ! commands and honour ANSI color escapes.


Solution

  • You can't. But you can suspend the editor and drop to a shell relatively quickly;

    Or you can use Ansi Filter to remove the escape sequences so you will at least not see a mess.