Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.3k views
in Technique[技术] by (71.8m points)

vim - Problem with text editors in macOS for Diff of two files with ANSI escape codes?

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:

  1. 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.

  2. 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.

  3. 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

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...