I use echo -e
to color my scripts output, it works fine when using standard output.
But when I redirect the output to a file, vim doesn't show the colors, instead of that it shows signs like this ^[[
example:
echo -e "\e[32m Green message\e[0m";
echo -e "\e[31m Red message\e[0m";
with vim :
^[[32m Green message^[[0m
^[[31m Red message^[[0m
How to fix this.
NB: cat shows the colors too!!
cat
doesn't show the colors, it simply outputs (without the interpretation that Vim does) the contents to the terminal. The terminal translates the escape sequences into colors! – Counterclockwise