Skip to content

Commit

Permalink
gi: auto-select entry if only one remains
Browse files Browse the repository at this point in the history
  • Loading branch information
XPhyro committed Mar 1, 2024
1 parent 4f0648d commit 2844d38
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/sh/util/integration/git/gi
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ git_add() {

selection="$(
printf "%s\n" "*" "$files" \
| fzf --multi --preview="$PREVIEW"
| fzf --multi --preview="$PREVIEW" --bind=one:accept
)"

[ -z "$selection" ] && return
Expand All @@ -60,7 +60,7 @@ git_partial_add() {

selection="$(
printf "%s\n" "$files" \
| fzf --multi --preview="$PREVIEW"
| fzf --multi --preview="$PREVIEW" --bind=one:accept
)"

[ -z "$selection" ] && return
Expand All @@ -75,7 +75,7 @@ git_unstage() {

selection="$(
printf "%s\n" "$files" \
| fzf --multi --preview="$PREVIEW"
| fzf --multi --preview="$PREVIEW" --bind=one:accept
)"

[ -z "$selection" ] && return
Expand Down Expand Up @@ -104,7 +104,7 @@ git_commit() {
printf "%s\n" \
"Custom" \
"Create" \
| fzf --multi --preview="unbuffer git status"
| fzf --multi --preview="unbuffer git status" --bind=one:accept
)"

case "$selection" in
Expand All @@ -119,7 +119,7 @@ git_push() {
printf "%s\n" "Normal"
git status -sb | head -n 1 | grep -Eq '\[.*behind [0-9]+.*\]$' \
&& printf "%s\n" "Force With Lease" "Force"
} | fzf --select-1 --multi --preview="unbuffer git status"
} | fzf --select-1 --multi --preview="unbuffer git status" --bind=one:accept
)"

case "$selection" in
Expand Down Expand Up @@ -157,7 +157,7 @@ while :; do
&& printf "%s\n" "Push"
)"

command="$(printf "%s\n" "$available_commands" | fzf --header="Select Git Command" --preview="unbuffer git status")"
command="$(printf "%s\n" "$available_commands" | fzf --header="Select Git Command" --preview="unbuffer git status" --bind=one:accept)"

case "$command" in
"Show") git_show;;
Expand Down

0 comments on commit 2844d38

Please sign in to comment.