Friday, September 30, 2016

WinMerge Alternative in Linux Terminal

WinMerge is a good open source tool to compare text files, but it only runs in Windows platforms. When I need to compare text files in Linux terminal, I use vimdiff (Vim in diff mode). Actually, Emacs also has similar feature. However, I prefer Vim because it's more handy.

To compare two files with vimdiff, you just need to run the vimdiff command with the path of the files you want to compare:
vimdiff file1 file2
Then, you will see something like below:
You can edit the files as a normal Vim editor. However, I would like to highlight some useful commands in diff mode of vim:
]c
Jump to next change
]c
Jump to prev change
do
Update the current change by copying the change of another buffer.
dp
Update change of another buffer by copying the current change of this buffer.
Ctrl-w Ctrl-w
Switch to another buffer

No comments: