glog: Make changing previews persistent

Switch to using the `change-preview()` action that was introduced in
0.29.0 (which was actually not yet released for a year when this feature
was first written). The old `preview()` is a one-off action while
`change-preview()` changes the `--preview` option.

This had the downside that when changing to a different preview and
moving to the next commit one would had to repeat the change. This was
especially annoying when looking through the history of a file that was
renamed. With the commit that renamed the file all previous commits
broke in the `files_only` preview as the path didn't exist yet (A
possible but probably pretty hard TODO to fix).

TODO: glog: Fix files_only preview for renamed files or give prompt to
      change the paths
This commit is contained in:
2024-11-01 01:16:10 +01:00
parent 4f25801402
commit ed4dac6f82

View File

@@ -99,11 +99,11 @@ local -A binds=(
# TODO: This assumes less to be used in core.pager
"enter" "execute@$fzf_preview[patch] | $pager -+F@"
# Preview stats
"ctrl-s" "preview($fzf_preview[stat])"
"ctrl-s" "change-preview($fzf_preview[stat])"
# Preview patch
"ctrl-p" "preview($fzf_preview[patch])"
"ctrl-p" "change-preview($fzf_preview[patch])"
# Files only
"ctrl-f" "preview($fzf_preview[files_only])"
"ctrl-f" "change-preview($fzf_preview[files_only])"
)
# TODO: Make the --preview argument dependent of --stat flag (i.e.