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
It is usually a bad idea to add any ANSI escape characters to your output if that output is meant to be processed by another program.
Because it is a text editor, it is reasonable to expect Vim to display the content of the file as it is, with the escape characters, rather than as you want it to look.
So no, there's nothing to fix, here. On Vim's side, anyway.