1:在用vim比对两个文件时,发现报错了.我用的debian stable,vim是aptitude 过来的vim7.2
2:于是跟踪下diff
root@host:/usr/share/vim/vim72# type diff diff is /usr/bin/diff root@host:/usr/share/vim/vim72# type vimdiff vimdiff is /usr/bin/vimdiff root@host:/usr/share/vim/vim72# ll /usr/bin/vimdiff lrwxrwxrwx 1 root root 25 [2012-08-06 3:27] /usr/bin/vimdiff -> /etc/alternatives/vimdiff* root@host:/usr/share/vim/vim72# ll /etc/alternatives/vimdiff lrwxrwxrwx 1 root root 16 [2012-08-06 3:27] /etc/alternatives/vimdiff -> /usr/bin/vim.gtk* root@host:/usr/share/vim/vim72#
随便建2个文件类似的内容.有细小区别的.
#echo '111 222 333'>1.txt #echo '111 222 333'>>1.txt #echo '111 222 333 444'>>1.txt #cp 1.txt 2.txt #echo '111 222 333 44455'>>2.txt #diff 1.txt 2.txt
正常diff
#vimdiff 1.txt 2.txt 报错
/bin/bash: /usr/share/vim/vim72diff No Such file or directory
#ln -s /usr/bin/diff /usr/share/vim/vim72diff
要是编译的7.3的.类似换成vim73diff就行了.路径看你编译的位置
4:diff成功(我改了1.txt的第二行内容)
5. 要对比文件夹 用 diff -r path1 path2
也可以用meld ,推荐这个,官方主页在下面
http://meldmerge.org/
安装在debian下很简单
#apt-get install meld
有可能缺失插件intltool,需要一起安装apt-get install intltool
也可以用beyond compare3
地址在这里
http://www.scootersoftware.com/download.php
选择对应的版本 下下来安装即可 ,括号里面是序列号...(
WINDOWS// 2013-05-08 更新 系统如果升级,需要重新安装下vim-gnome or vim-gtk 然后再做下面的操作
#ln -s /usr/bin/diff /usr/share/vim/vim73diff
注意,如果使用了第三方的bash输出的,比如cw(color wrapper) (http://blog.csdn.net/rainysia/article/details/8673199), 需要注释掉bashrc里面这个,先ln -s了后再去重新编译安装cw .