Diff
1diff --git a/plugins/wd2/wd2/wd.plugin.zsh b/plugins/wd/wd.plugin.zsh
2rename from plugins/wd2/wd2/wd.plugin.zsh
3rename to plugins/wd/wd.plugin.zsh
4index e0846ffd9037c95969453445002d2e52ca278eba..bbec4a7154a58572d74e389251ee1d4747c1aa5a 100755
5--- a/plugins/wd2/wd2/wd.plugin.zsh
6+++ b/plugins/wd/wd.plugin.zsh
7@@ -6,4 +6,4 @@
8 #
9 # @github.com/mfaerevaag/wd
10
11-alias wd='. ~/.oh-my-zsh/plugins/wd/wd.sh'
12+alias wd='. $ZSH/plugins/wd/wd.sh'
13diff --git a/plugins/wd2/wd2/wd.sh b/plugins/wd/wd.sh
14rename from plugins/wd2/wd2/wd.sh
15rename to plugins/wd/wd.sh
16index 7852028c061c8a96f411ecf286afa01b82e5e6aa..744f58bc2039a5e1c6054a5ad0aab77fa2aa165f 100755
17--- a/plugins/wd2/wd2/wd.sh
18+++ b/plugins/wd/wd.sh
19@@ -19,6 +19,13 @@ RED="\033[91m"
20 NOC="\033[m"
21
22
23+# check if config file exists
24+if [[ ! -a $CONFIG ]]
25+then
26+ # if not: create config file
27+ touch $CONFIG
28+fi
29+
30 ## load warp points
31 typeset -A points
32 while read line
33@@ -120,11 +127,12 @@ wd_print_msg()
34
35 wd_print_usage()
36 {
37- print "Usage: wd [add|-a|--add] [rm|-r|--remove] [ls|-l|--list] <point>"
38+ print "Usage: wd [add|-a|--add] [rm|-r|--remove] [ls|-l|--list] <point>"
39 print "\nCommands:"
40 print "\t add \t Adds the current working directory to your warp points"
41 print "\t add! \t Overwrites existing warp point"
42 print "\t remove Removes the given warp point"
43+ print "\t show \t Outputs warp points to current directory"
44 print "\t list \t Outputs all stored warp points"
45 print "\t help \t Show this extremely helpful text"
46 }
47@@ -135,13 +143,20 @@ wd_print_usage()
48 # get opts
49 args=`getopt -o a:r:lhs -l add:,remove:,list,help,show -- $*`
50
51+# check if no arguments were given
52 if [[ $? -ne 0 || $#* -eq 0 ]]
53 then
54 wd_print_usage
55-else
56- # can't exit, as this would exit the excecuting shell
57- # e.i. your terminal
58
59+# check if config file is writeable
60+elif [[ ! -w $CONFIG ]]
61+then
62+ wd_print_msg $RED "\'$CONFIG\' is not writeable."
63+ # do nothing => exit
64+ # can't run `exit`, as this would exit the executing shell
65+ # i.e. your terminal
66+
67+else
68 #set -- $args # WTF
69
70 for i