I have two log files in macOS where colors are defined by ANSI Escape codes
and want to compare them. Having ANSI escape codes in plain text makes it really annoying to read the diff. I am looking for either (i) removing the ANSI escape codes from files, or (ii) bringing back the colour highlighting to the log files. Any recommendations?
I tried some text edirors in Mac but no success:
Sublime text. Installed ANSIescape using 'Sublime Package Control'. It's nice for displaying ANSI code with color for a single file, but it does not work for comparing two files. Because the diff are displayed in two separate files, not side-by-side.
Visual studio code. It has nice side-by-side comparison by the command code --diff file1 file2
, but I failed to find any ANSI escape codes plugins for VS code.
Vim. I failed to install the plugin based on AnsiEsc.vim.
Once I had installed it in other system, but the problem was when you open the vim editor every time you need to type :AnsiEsc, as discussed here. The error I get in installing the plugin is:
*vimball*** (vimball#Decompress) gunzip may have failed with <~/AnsiEsc.vba.gz>
Press <cr> to continue
***vimball*** Source this file to extract it! (:so %)
Error detected while processing SourceCmd Auto commands for "*.vba.gz":
E484: Can't open file ~/AnsiEsc.vba
question from:
https://stackoverflow.com/questions/65872593/problem-with-text-editors-in-macos-for-diff-of-two-files-with-ansi-escape-codes 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…