summaryrefslogtreecommitdiffstats
path: root/content/blog
diff options
context:
space:
mode:
authorMatthew Lemon <matt@matthewlemon.com>2022-08-17 15:16:39 +0100
committerMatthew Lemon <matt@matthewlemon.com>2022-08-17 15:16:39 +0100
commit161c295d123f04d7831cce5a237fd059b1499553 (patch)
treefebe5bc8e21af7846dc99a0e8e429ef1016d06b9 /content/blog
parentd2b015e2317f5a3acfa2f070a0278ac7934e5d89 (diff)
update
Diffstat (limited to 'content/blog')
-rw-r--r--content/blog/vimdiff.md44
1 files changed, 44 insertions, 0 deletions
diff --git a/content/blog/vimdiff.md b/content/blog/vimdiff.md
new file mode 100644
index 0000000..f613525
--- /dev/null
+++ b/content/blog/vimdiff.md
@@ -0,0 +1,44 @@
+---
+title: "Git diff with vimdiff"
+date: 2022-08-17T15:06:57+01:00
+draft: false
+categories: ['Computing']
+tags: [vim, git]
+---
+
+### git difftool
+
+You could just do:
+
+> `git difftool --tool=vimdiff --no-prompt`
+
+This will open `git diff` in vim.
+
+To tell git to always use vimdiff:
+
+> `git-config --global diff.tool vimdiff`
+`git-config --global merge.tool vimdiff`
+
+Omit `--global` to set these for the repo in the working directory.
+
+Once these settings are set, you can do `git difftool` to launch it.
+
+Another useful config is `difftool.prompt` - this will stop Vim prompting about
+launching `vimdiff`:
+
+> `git-config --global difftool.prompt false`
+
+### Basic vimdiff
+
+`]c` - next difference \
+`[c` - previous difference \
+`do` - diff obtain \
+`dp` - diff put \
+`zo` - open folded text \
+`zc` - close folded text \
+`:diffupdate` - re-scan the files for differences \
+
+### IMPORTANT - READ-ONLY
+
+By default, vimdiff opens both file in READONLY mode. To be able to make changes to the file, do `:set noro` in vim, which will remove READONLY.
+