Diff
1diff --git a/plugins/wd/README.md b/plugins/wd/README.md
2index 8791f9f0ee931413490282ae61c25f24a1b9145f..1d19806322b349611ff2ff6bcb8044c1733ebe7c 100644
3--- a/plugins/wd/README.md
4+++ b/plugins/wd/README.md
5@@ -1,12 +1,12 @@
6 # wd
7
8-[](https://travis-ci.org/mfaerevaag/wd)
9+[](https://github.com/mfaerevaag/wd/actions)
10
11 `wd` (*warp directory*) lets you jump to custom directories in zsh, without using `cd`.
12 Why?
13 Because `cd` seems inefficient when the folder is frequently visited or has a long path.
14
15-
16+
17
18 ## Setup
19
20@@ -36,6 +36,10 @@ In your `.zshrc`:
21 antibody bundle mfaerevaag/wd
22 ```
23
24+### [Fig](https://fig.io)
25+
26+Install `wd` here: [](https://fig.io/plugins/other/wd_mfaerevaag)
27+
28 ### Arch ([AUR](https://aur.archlinux.org/packages/zsh-plugin-wd-git/))
29
30 1. Install from the AUR
31diff --git a/plugins/wd/wd.sh b/plugins/wd/wd.sh
32index 9085c5b7b76bd7df5366f588b84e8cb89f68dd27..e51cf906a780de5dccdf4f9ed591f1ecab41c75c 100644
33--- a/plugins/wd/wd.sh
34+++ b/plugins/wd/wd.sh
35@@ -163,6 +163,7 @@ wd_add()
36 {
37 local point=$1
38 local force=$2
39+ cmdnames=(add rm show list ls path clean help)
40
41 if [[ $point == "" ]]
42 then
43@@ -178,6 +179,9 @@ wd_add()
44 elif [[ $point =~ : ]] || [[ $point =~ / ]]
45 then
46 wd_exit_fail "Warp point contains illegal character (:/)"
47+ elif (($cmdnames[(Ie)$point]))
48+ then
49+ wd_exit_fail "Warp point name cannot be a wd command (see wd -h for a full list)"
50 elif [[ ${points[$point]} == "" ]] || [ ! -z "$force" ]
51 then
52 wd_remove "$point" > /dev/null
53@@ -185,7 +189,7 @@ wd_add()
54 if (whence sort >/dev/null); then
55 local config_tmp=$(mktemp "${TMPDIR:-/tmp}/wd.XXXXXXXXXX")
56 # use 'cat' below to ensure we respect $WD_CONFIG as a symlink
57- command sort -o "${config_tmp}" "$WD_CONFIG" && command cat "${config_tmp}" > "$WD_CONFIG" && command rm "${config_tmp}"
58+ command sort -o "${config_tmp}" "$WD_CONFIG" && command cat "${config_tmp}" >| "$WD_CONFIG" && command rm "${config_tmp}"
59 fi
60
61 wd_export_static_named_directories
62@@ -214,7 +218,7 @@ wd_remove()
63 then
64 local config_tmp=$(mktemp "${TMPDIR:-/tmp}/wd.XXXXXXXXXX")
65 # Copy and delete in two steps in order to preserve symlinks
66- if sed -n "/^${point_name}:.*$/!p" "$WD_CONFIG" > "$config_tmp" && command cp "$config_tmp" "$WD_CONFIG" && command rm "$config_tmp"
67+ if sed -n "/^${point_name}:.*$/!p" "$WD_CONFIG" >| "$config_tmp" && command cp "$config_tmp" "$WD_CONFIG" && command rm "$config_tmp"
68 then
69 wd_print_msg "$WD_GREEN" "Warp point removed"
70 else
71@@ -251,7 +255,7 @@ wd_list_all()
72 then
73 arr=(${(s,:,)line})
74 key=${arr[1]}
75- val=${arr[2]}
76+ val=${line#"${arr[1]}:"}
77
78 if [[ -z $wd_quiet_mode ]]
79 then
80@@ -389,6 +393,11 @@ else
81 wd_export_static_named_directories
82 fi
83
84+# disable extendedglob for the complete wd execution time
85+setopt | grep -q extendedglob
86+wd_extglob_is_set=$?
87+[[ $wd_extglob_is_set ]] && setopt noextendedglob
88+
89 # load warp points
90 typeset -A points
91 while read -r line
92@@ -475,6 +484,9 @@ fi
93 # if not, next time warp will pick up variables from this run
94 # remember, there's no sub shell
95
96+[[ $wd_extglob_is_set ]] && setopt extendedglob
97+
98+unset wd_extglob_is_set
99 unset wd_warp
100 unset wd_add
101 unset wd_remove