工作中经常需要用到文本比较功能,之前有用在线的
https://www.hxdev.cn/app/TextDiff/TextDiff.html
但是体验不好,也不安全。
因为工作本是mac,mac上已经装了sublime(也有相应的windows版本)。个人感觉这是一款比较强大的文本编辑器,支持各种插件。下面简单介绍sublimerge的安装和使用
安装
command + shift + P
出现搜索框,输入
sublimerge
选择相应的版本按下回车即可(本人安装的是 sublimerge 3.x,也可以安装其它类似 pro 之类的。)
安装完成之后就会自动打开一个文件,提示你怎么使用。
使用
Simplified usage instructions
=============================
In file view:
[ctrl]+[alt]+[d] - display Quick Panel with commands available for current view
In diff view:
Windows/Linux:
[ctrl]+[down] - select next change
[ctrl]+[up] - select previous change
* [ctrl]+[left] - copy selected change (or active line) to left from right
* [ctrl]+[right] - copy selected change (or active line) to right from left
[ctrl]+[shift]+[left] - copy all changes to left from right
[ctrl]+[shift]+[right] - copy all changes to right from left
OSX:
[alt]+[down] - select next change
[alt]+[up] - select previous change
* [alt]+[left] - copy selected change (or active line) to left from right
* [alt]+[right] - copy selected change (or active line) to right from left
[alt]+[shift]+[left] - copy all changes to left from right
[alt]+[shift]+[right] - copy all changes to right from left
Common:
[f3] - swap panels
[f4] - show changes navigator
[f5] - recompare buffers
* - if change is selected the command will copy its whole contents, otherwise will copy only the focused line
In directories diff view:
[down] - select next file/directory
[up] - select previous file/directory
[left] - copy file/directory from right to left
[right] - copy file/directory from left to right
[enter] - enter sub directory / compare text files
[backspace] - enter parent directory
Windows/Linux:
[ctrl]+[down] - select next different file/directory
[ctrl]+[up] - select previous different file/directory
OS X:
[alt]+[down] - select next different file/directory
[alt]+[up] - select previous different file/directory
For convenience Sublimerge also supports standard OS X keyboard shortcuts for directories navigation:
[cmd]+[down] - enter sub directory / compare text files
[cmd]+[up] - enter parent directory
- 将需要比较的文件打开
- 在其中一个文件中敲 [ctrl]+[alt]+[d]
- 在弹出的搜索框中选择需要比较的另外一个文件
- 结束