aboutsummaryrefslogtreecommitdiff
path: root/.functions
diff options
context:
space:
mode:
authorGuangxiong Lin <[email protected]>2022-01-23 12:29:00 +0800
committerGuangxiong Lin <[email protected]>2022-01-23 12:29:00 +0800
commitcef30030bef011b506a568b5a1bd46b99ead72c0 (patch)
tree2e0ef882b36c947a31afe99ca68e15274a8de642 /.functions
parent8b4f1525d95066464316156ec5a3c1b2c1c00e0c (diff)
downloaddotfiles-cef30030bef011b506a568b5a1bd46b99ead72c0.tar.gz
dotfiles-cef30030bef011b506a568b5a1bd46b99ead72c0.tar.bz2
dotfiles-cef30030bef011b506a568b5a1bd46b99ead72c0.zip
Add function and alias to help code review
Add following aliases: - gmf: Show the changed files from base branch to current branch - gmfn: Similar to gmfn, but only contains the name of changed files Add a function: - greview: Open all changed files in vim. Map <leader>gd to show the diff between base branch and current branch.
Diffstat (limited to '.functions')
-rw-r--r--.functions18
1 files changed, 18 insertions, 0 deletions
diff --git a/.functions b/.functions
index 9390af8..879804c 100644
--- a/.functions
+++ b/.functions
@@ -9,3 +9,21 @@ open () {
echo "No usable program is found"
fi
}
+
+greview () {
+ usage='usage: greview <base_branch>'
+ if [ $# -lt 1 ]; then
+ echo $usage
+ return
+ fi
+
+ base_branch=$1
+ # vim -p $(git diff --merge-base --name-only $base_branch) \
+ # "+tabdo Gvdiff $base_branch" \
+ # "+nmap <C-j> :tabnext<CR>" \
+ # "+nmap <C-k> :tabpreivous<CR>"
+
+ vim $(git diff --merge-base --name-only $base_branch) \
+ "+nmap <leader>gd :Gvdiffsplit $base_branch<CR>"
+
+}