There are many diff tools to compare files like vimdiff, kdiff3, diffmerge, etc, but then why should I use Vim to compare files ? I regularly use diffmerge to compare files, but it hungs while comparing large log files ( for ex. I found it difficult to compare 20MB log file).
Also some time I just want to compare some section of build log, for example I want to compare the successful build log vs failed log at some section of build target. Typically build logs contain time stamp pre-fixed in the beginning and if I compare 2 build logs, almost every line differs between them.
So in such cases I just prefer to view two log files side-by-side using vim using the following vim options
Also some time I just want to compare some section of build log, for example I want to compare the successful build log vs failed log at some section of build target. Typically build logs contain time stamp pre-fixed in the beginning and if I compare 2 build logs, almost every line differs between them.
So in such cases I just prefer to view two log files side-by-side using vim using the following vim options
- Open log1
- vi log1.txt
- split the screen vertically
- :split
- Switch to the right-portion
- ctrl+ww
- You can use this to toggle between screens
- Open another file to compare in right-portion
- :o log2.txt
- Two scroll down both sides of the screen together
- Start with leg-side by typing below option
- :set scrollbind
- Switch to right portion and type the above option again
- To unset this -> :set noscrollbind
No comments:
Post a Comment