Vimdiff 笔记

发现这小工具真好用. diff 效果惊人.

git 的配置:

$ git config --global diff.tool vimdiff

# 看一下设置是否生效
$ git config --global -l
user.name=***
user.email=***
push.default=simple
http.sslverify=false
filter.lfs.smudge=git-lfs smudge -- %f
filter.lfs.process=git-lfs filter-process
filter.lfs.required=true
filter.lfs.clean=git-lfs clean -- %f
core.autocrlf=input
credential.helper=cache --timeout=3600
diff.tool=vimdiff # 设置成功

启动 vimdiff:

vimdiff file1.txt file2.txt
vim -d file1.txt file2.txt

cheatsheet:

  • zc: close folding (zC to close all)
  • za: open folding (zA to open all)
  • c-w c-w: jump to another window
  • ]c: next difference
  • [c: previous difference
  • dp: diffput, puts changes under the cursor into the other file making them identical (thus removing the diff); 推过去
  • do: diffget, 拉过来;
Vimdiff 笔记_第1张图片
其实呢, c-w c-w 能保持你的 tempo, 敲键的节奏很重要

references:

  • 技巧:Vimdiff 使用
  • Vim documentation: diff
  • vimdiff - How do I use vim as a diff tool? - Vi and Vim Stack Exchange
  • Git - git-difftool Documentation
  • vimdiff cheat sheet

你可能感兴趣的:(Vimdiff 笔记)