Skip to content

Commit 8200d4d

Browse files
bitkeenwfxr
authored andcommitted
Fix nothing-chosen and multiple-chosen cases
With previous version: 1. Exiting fzf without choosing a URL leads to the following error in tmux: ``` '/home/user/.tmux/plugins/tmux-fzf-url/fzf-url.sh '' screen' returned 1 ``` 2. Choosing multiple URLs leads to them being joined into a single one Bash version 5.1.16 on Linux.
1 parent ccd9e22 commit 8200d4d

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

fzf-url.sh

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,7 @@ items=$(printf '%s\n' "${urls[@]}" "${wwws[@]}" "${ips[@]}" "${gits[@]}" "${extr
5151
)
5252
[ -z "$items" ] && tmux display 'tmux-fzf-url: no URLs found' && exit
5353

54-
chosen=$(fzf_filter <<< "$items" | awk '{print $2}')
55-
56-
for item in "${chosen[@]}"; do
57-
open_url "$item" &>"/tmp/tmux-$(id -u)-fzf-url.log"
58-
done
54+
printf '%s' "$items" | fzf_filter | awk '{print $2}' | \
55+
while read -r chosen; do
56+
open_url "$chosen" &>"/tmp/tmux-$(id -u)-fzf-url.log"
57+
done

0 commit comments

Comments
 (0)