File tree Expand file tree Collapse file tree 1 file changed +18
-3
lines changed Expand file tree Collapse file tree 1 file changed +18
-3
lines changed Original file line number Diff line number Diff line change @@ -353,7 +353,18 @@ _forgit_show_view() {
353
353
repo=$( git rev-parse --show-toplevel)
354
354
cd " $repo " || return 1
355
355
echo " $input_line " | _forgit_get_files_from_diff_line | xargs -0 \
356
- " $FORGIT " exec_show " ${commit} " -U" $diff_context " -- | _forgit_pager diff
356
+ " $FORGIT " exec_show " ${commit} ^{commit}" -U" $diff_context " -- | _forgit_pager diff
357
+ }
358
+
359
+ _forgit_show_preview () {
360
+ local input_line=$1
361
+ local diff_context=$2
362
+ local commit=$3
363
+ if [[ " $FZF_PREVIEW_LABEL " =~ " Diff" ]]; then
364
+ _forgit_show_view " ${input_line} " " ${diff_context} " " ${commit} "
365
+ else
366
+ git show --quiet --color=always " ${FZF_PROMPT%% * } "
367
+ fi
357
368
}
358
369
359
370
_forgit_show_enter () {
@@ -381,8 +392,12 @@ _forgit_show() {
381
392
opts="
382
393
$FORGIT_FZF_DEFAULT_OPTS
383
394
+m -0 --bind=\" enter:execute($FORGIT show_enter {} $escaped_commit | $FORGIT pager enter)\"
384
- --preview=\" $FORGIT show_view {} '$_forgit_preview_context ' $escaped_commit \"
395
+ --preview=\" $FORGIT show_preview {} '$_forgit_preview_context ' $escaped_commit \"
396
+ --preview-label=\" Diff \"
385
397
--bind=\" alt-e:execute($FORGIT edit_diffed_file {})+refresh-preview\"
398
+ --bind \" alt-t:transform:[[ ! \$ FZF_PREVIEW_LABEL =~ 'Diff' ]] &&
399
+ echo 'change-preview-label( Diff )+refresh-preview' ||
400
+ echo 'change-preview-label( Commit Message )+refresh-preview'\"
386
401
$FORGIT_DIFF_FZF_OPTS
387
402
--prompt=\" ${commit} > \"
388
403
"
@@ -1104,7 +1119,7 @@ private_commands=(
1104
1119
" revert_preview"
1105
1120
" reset_head_preview"
1106
1121
" show_enter"
1107
- " show_view "
1122
+ " show_preview "
1108
1123
" stash_push_preview"
1109
1124
" stash_show_preview"
1110
1125
" yank_sha"
You can’t perform that action at this time.
0 commit comments