summaryrefslogtreecommitdiff
path: root/plugins/wd/wd.sh
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/wd/wd.sh')
-rwxr-xr-xplugins/wd/wd.sh10
1 files changed, 6 insertions, 4 deletions
diff --git a/plugins/wd/wd.sh b/plugins/wd/wd.sh
index 160ab3be3..34f887a0e 100755
--- a/plugins/wd/wd.sh
+++ b/plugins/wd/wd.sh
@@ -261,9 +261,9 @@ wd_browse() {
local entries=("${(@f)$(sed "s:${HOME}:~:g" "$WD_CONFIG" | awk -F ':' '{print $1 " -> " $2}')}")
local script_path="${${(%):-%x}:h}"
local wd_remove_output=$(mktemp "${TMPDIR:-/tmp}/wd.XXXXXXXXXX")
- local entries_with_headers=("All warp points:" "Press enter to select. Press delete to remove" "${entries[@]}")
+ entries=("All warp points:" "Press enter to select. Press delete to remove" "${entries[@]}")
local fzf_bind="delete:execute(echo {} | awk -F ' -> ' '{print \$1}' | xargs -I {} "$script_path/wd.sh" rm {} > "$wd_remove_output")+abort"
- local fzf_command=$(printf '%s\n' "${entries_with_headers[@]}" | fzf --height 100% --reverse --header-lines=2 --bind="$fzf_bind")
+ local selected_entry=$(printf '%s\n' "${entries[@]}" | fzf --height 100% --reverse --header-lines=2 --bind="$fzf_bind")
if [[ -e $wd_remove_output ]]; then
cat "$wd_remove_output"
rm "$wd_remove_output"
@@ -287,8 +287,10 @@ wd_browse_widget() {
}
wd_restore_buffer() {
- BUFFER=$saved_buffer
- CURSOR=$saved_cursor
+ if [[ -n $saved_buffer ]]; then
+ BUFFER=$saved_buffer
+ CURSOR=$saved_cursor
+ fi
saved_buffer=
saved_cursor=1
}