转载自<http://www.coreymaynard.com/blog/improving-svn-diff-with-the-power-of-vim/>

One of vim's nice features is a powerful diff tool that can be used to easily tell the differences between multiple different files. This can be called up at any time by issuing the following:

vimdiff file1.xxx file2.xxx

Subversion's default diff tool - while effective - lacks a lot of options. Firstly, it simply outputs the results of the diff to standard out. This is limiting for several reasons: you can't edit the files you're diffing, so quickly changing code is impossible. There's also no color or syntax highlighting, so telling at a glance what's changed is more difficult. Vimdiff solves all these problems, as it drops you into a full instance of vim allowing you to do anything.

Why use svn diff when we can seamlessly integrate vimdiff into the workflow in two simple steps? Let's get started!

Step 1: The Script

The first thing that needs to be done is to create a simple bash script that will be the wrapper for svn diff. Create the following file on your system named diffwrap.sh:

#!/bin/sh# Configure your favorite diff program here.
DIFF="/usr/bin/vimdiff"# Subversion provides the paths we need as the sixth and seventh
# parameters.
LEFT=${6}
RIGHT=${7}# Call the diff command
$DIFF $LEFT $RIGHT

You can either put it in a system wide folder (/usr/local/bin) or in your own folder. In any event, don't forget to

chmod a+x diffwrap.sh

Step 2: Make Subversion Use It

Now that the script exists, we have to tell Subversion to use it for diff. Luckily that's quite easy. Simply edit ~/.subversion/config and find the diff-cmd line inside the [helpers] section. Uncomment it and change it to something like this:

diff-cmd = /path/to/diffwrap.sh

Step 3: Profit!

You're all done! To see it in action, change directory into a Subversion project with some local changes, and simply diff like normal:

svn diff

关于vimdiff的简单使用:

[c 跳转到上一个差异项

]c 跳转到下一个差异项

zo 展开折叠的相同代码
zc 重新折叠
dp 把当前处的差异项复制到另一个文件
do 将另一个文件的差异项复制到当前文件

转载于:https://www.cnblogs.com/jncpp/p/4230317.html

svn diff 使用 vimdiff 作为比较差异工具相关推荐

  1. 将svn diff改成用vimdiff命令进行可视化差异显示

    本文对原文稍作修改. svn的其他命令可在我的 各种平台常用命令和快捷键_莫能长老的博客-CSDN博客 SVN介绍.安装及常用命令总结_莫能长老的博客-CSDN博客 这两篇文章中找到. 基本原理是通过 ...

  2. 使用svn diff的-r参数的来比较任意两个版本的差异

    来源:http://blog.csdn.net/feliciafay/article/details/8962515 1 svn diff的用法 1.1 对比当前本地的工作拷贝文件(working c ...

  3. 如何使用 vimdiff 来 git diff /svn diff

    #git 如何实现vimdiffgit config --global diff.tool vimdiff git config --global difftool.prompt false git ...

  4. 3.14-19 wc、iconv、dos2unix、diff、vimdiff、rev

    3.14 wc:统计文件的行数.单词数或字节数 wc命令用于统计文件的行数.单词数或字节数. -c 统计字节数 -w 统计单词数 -l 统计行数     -L 打印最长行的长度 -m 统计字符数 查看 ...

  5. L24.linux命令每日一练 -- 第三章 文件过滤及内容编辑处理命令 -- diff和vimdiff命令

    3.17 diff:比较两个文件的不同 3.17.1 命令详解 ​ [命令星级] ★★★★☆ ​ [功能说明] ​ diff命令可以逐行比较纯文本文件的内容,并输出文件的差异. ​ [语法格式] di ...

  6. 删除svn_推荐:mac上svn常用命令及好用的工具

    作者:snandy来源:https://www.cnblogs.com/snandy/p/4072857.html # Mac SVN 命令行 Mac自带了SVN命令行,如我的升级到10.10(OSX ...

  7. 提交代码前没有用svn st命令(只用了svn diff), 差点踩坑!

    我还是建议大家在Windows上通过对比工具来提交程序, Windows上一切可见, 一目了然啊. 文件状态用颜色区分得一清二楚. 当然, 有的时候, 我们也可以在linux下提交程序. 最近我直接在 ...

  8. 在线JSON在线对比差异工具

    在线JSON在线对比差异工具 在线JSON在线对比差异工具 JSON在线对比差异工具,JSON在线对比差异工具,JSON在线对比差异工具 https://tooltt.com/json-diff/

  9. 手机比较版本差异工具

    CompareVersionDiff 导出每个手机版本的里面apk.property.xml配置,然后对比2个不同的版本之间的差异,来确认是否有非预期的修改被带入 背景: 手机项目开发进入后期,相关的 ...

最新文章

  1. 不可错过! CMU《高级自然语言处理》
  2. JavaScript中的的面向对象中的一些知识
  3. .Net Core及.Net Standard主要概念回顾
  4. Bootstrap中过渡效果(Transition)模态框插件的使用案例
  5. LeetCode 528. 按权重随机选择(前缀和+二分查找)
  6. 《高质量c++/c编程指南》学习摘要
  7. 设置时区,时间,日期的脚本
  8. 【Shell】特殊变量
  9. UNIX/Linux系统结构
  10. 张小龙《微信背后的产品观》
  11. USB转RS232串口线-交叉线or直连线
  12. “0x005346c4”指令引用的“0x00786000”内存,该内存不能为读
  13. 经验分享:如何系统学习 Web 前端技术?
  14. TCC(TinyC)编译器汉化(中文编译器、汉语编程)之一:主文件汉化
  15. bootpdf下载 spring_SpringBoot教程 PDF 下载
  16. Python搞不定蝴蝶图?
  17. MIPS RAM设计实验
  18. 小米盒子 android 动画特效,小米盒子3安装这些软件 丰富娱乐功能
  19. 最简单安装使用peda
  20. 年后市场将反弹?服装人做好这些准备,才能赚到2023年第一桶金!

热门文章

  1. const与指针变量
  2. python爬虫学习:电商数据分析
  3. 机器学习(八)支持向量机svm终结篇
  4. C#-JSON的序列化和反序列化
  5. linux桌面2k分辨率,解决ubuntu下外接2k显示器却没法调2k分辨率问题
  6. 2019年网络规划设计师上午真题及答案解析
  7. python dll文件丢失_python34.dll
  8. Java基础----JAVA语言的概述和开发环境的搭配
  9. AJAX异步-向服务器提交数据
  10. spring jpa.踩坑经验分享