vim & colors from ANSI Escape Sequences: how to display in vim the same colors that are displayed with the cat command
The terminal output will be colored if the content of the file will be sent "as-is" to the terminal, without any modifications. However, vim and some other editors will escape meta characters in the text and instead maybe add some other color codes for their syntax highlighting, so this doesn't work.
Try dumping the file to the terminal with cat
, this should work. Some simple editors or pagers like less
might also work.
Edit: I have not found a way to let vim "pass-through" all the escape codes, but I have found this answer which links to this vim script, which parses the escape codes and uses the vim syntax highlighting to recreate the color codes in the output. According to its description, it should do exactly what you want (but I have not tested it).