From 1a3a06230953730197b11e059610d735c2ada2f5 Mon Sep 17 00:00:00 2001 From: druckdev <63563978+druckdev@users.noreply.github.com> Date: Sat, 10 Oct 2020 13:10:39 +0200 Subject: [PATCH] zsh:glog: Small fixes Commit hashes only contain letters from a-f. Use heredoc for the fzf preview command for better readability. --- .config/zsh/autoload/glog | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/.config/zsh/autoload/glog b/.config/zsh/autoload/glog index 6362cff..d55e592 100755 --- a/.config/zsh/autoload/glog +++ b/.config/zsh/autoload/glog @@ -15,7 +15,7 @@ git rev-parse || return local formatshort='--pretty=format:%C(yellow)%h %Creset%s%C(auto)%d' # Verbose format for the preview window on the right # This array is stitched together with newlines later -local format=( +local -a format=( '--pretty=format:%C(yellow)' # newline created by this eaten by %- '%-commit: %H%C(auto)' # yellow commit hash '%-D%Cblue' # auto colored ref names (if any) @@ -34,11 +34,20 @@ local format=( local del_ansi='s/\[[0-9]{0,2}m//g' # Ignore the graph part at the beginning, then capture the commit hash and throw # away the rest of the line. -local commit_hash='s/^[ */\\|]*([a-z0-9]*).*$/\1/' +local commit_hash='s/^[ */\\|]*([a-f0-9]+).*$/\1/' local dateshort='--date=format:%F' # year local date='--date=format:%F %T %z' # year time timezone local colors='--color=always' + +local fzf_preview_command +read -r -d '' fzf_preview_command <