aboutsummaryrefslogtreecommitdiff
path: root/.tigrc
diff options
context:
space:
mode:
authorGuangxiong Lin <[email protected]>2022-01-23 00:04:34 +0800
committerGuangxiong Lin <[email protected]>2022-01-23 00:04:34 +0800
commit307ddada77b66c418f65ee0100e7a2ba0be64b85 (patch)
tree724807bb8ff6309d86696ed7b5ba59957441617f /.tigrc
parent37ed58d7f49483b1eee38faaadd4cc5cf2626109 (diff)
downloaddotfiles-307ddada77b66c418f65ee0100e7a2ba0be64b85.tar.gz
dotfiles-307ddada77b66c418f65ee0100e7a2ba0be64b85.tar.bz2
dotfiles-307ddada77b66c418f65ee0100e7a2ba0be64b85.zip
Add difftool keybinds in tig config
Add keybinds to call git difftool in tig. Use D in all views to show the diffs of commit/file. Besides, this commit also changes the structure of .tigrc file.
Diffstat (limited to '.tigrc')
-rw-r--r--.tigrc36
1 files changed, 24 insertions, 12 deletions
diff --git a/.tigrc b/.tigrc
index 904236d..a5bed01 100644
--- a/.tigrc
+++ b/.tigrc
@@ -1,19 +1,31 @@
-bind generic + !git commit --amend
-bind generic 9 @sh -c "echo -n %(commit) | xclip -selection c"
-bind generic T !git notes edit %(commit)
-bind refs 3 !git rebase -i %(branch)
+# Navigation
+bind generic g move-first-line
+bind generic G move-last-line
+bind main G move-last-line
-# Search for previous diff (c)hunk and next diff header
+# Search for diff (c)hunk and diff header
bind stage 2 :?^@@
-bind stage D :/^diff --(git|cc)
+bind diff 2 :?^@@
+bind stage 3 :/^diff --(git|cc)
+bind diff 3 :/^diff --(git|cc)
+
+# Changes
+bind generic + ?git commit --amend
+
+# Branches
+bind refs 3 ?git rebase -i %(branch)
+bind refs M ?git merge %(branch)
# Grep view
bind generic S view-grep
-# Copy current commit ID to the clipboard
-bind generic I !git add -i %(file)
+# Use git difftool to view the diff
+bind generic D !git difftool --no-prompt --trust-exit-code %(commit)^!
+bind diff D !git difftool --no-prompt --trust-exit-code %(commit)^! -- %(file)
+bind stage D !git difftool --no-prompt --trust-exit-code HEAD -- %(file)
+bind stage D !sh -c "git difftool --tool=vimdiff --trust-exit-code --no-prompt `expr '%(status)' : 'Staged changes' >/dev/null && echo --staged` -- '%(file)'"
-# Navigation
-bind generic g move-first-line
-bind generic G move-last-line
-bind main G move-last-line
+# Misc
+bind generic T !git notes edit %(commit)
+## Copy current commit ID to the clipboard
+bind generic 9 @sh -c "echo -n %(commit) | xclip -selection c"