zsh:glog: Push to editor buffer rather clipboard

This removes the dependency of xclip and makes it more usable since when
I need the commit hash it will almost always be in the next command.
This commit is contained in:
2020-10-10 13:12:19 +02:00
parent 1a3a062309
commit d8f432655e

View File

@@ -72,12 +72,10 @@ commit="$(\
git log "$formatshort" --graph "$dateshort" "$colors" \ git log "$formatshort" --graph "$dateshort" "$colors" \
| fzf "${fzf_args[@]}" | fzf "${fzf_args[@]}"
)" )"
# If fzf exits successfully, put the abbreviated commit hash into the clipboard # If fzf exits successfully, push the abbreviated commit hash onto the editing
# and write it onto stdout. # buffer stack and write it to stdout.
if ! (( $? )); then if ! (( $? )); then
commit="$(sed -Ee "$del_ansi" -e "$commit_hash" <<<"$commit")" commit="$(sed -Ee "$del_ansi" -e "$commit_hash" <<<"$commit")"
if command -v xclip &>/dev/null; then pushln "$commit"
echo -n "$commit" | xclip -selection clip
fi
echo "$commit" echo "$commit"
fi fi