3 # To list all git modified items in the given directory
6 git rev-parse ||
return 1
7 git
diff --diff-filter=M
--name-only "$@"
10 # Recursively show diffs for all the modified files
11 function gitshowdiffs
()
14 git_patch_file
="$HOME/tmp/gitpatchfile"
17 git_dir
="$(git rev-parse --git-dir)" ||
return 1
19 for i
in $
(gitmodified
"$@"); do
21 if ! confirm
"$i: continue" 1; then
22 if [ "$CONFIRMED" = "no" ]; then
25 elif [ "$CONFIRMED" = "quit" ]; then
31 # With control character to clear the entire line
32 echo -e "\r\e[2Kgetting diff..."
33 git
diff --no-prefix --no-ext-diff "$i" > "$git_patch_file" ||
return
35 if [ "$(stat -c %s "$git_patch_file")" -eq 0 ]; then
36 echo "gitshowdiffs: $i: no diff found"
39 DISPLAY
= vi
-n '+set patchexpr=MyPatch()' \
40 "+leftabove vertical diffpatch $git_patch_file |cmap q qa|nmap <F7> ]c|nmap <F6> [c|windo set fdm=diff nolist|normal gg" \