Browse code

Added installation function

Matt Cable authored on 20/09/2010 at 01:43:49
Showing 1 changed files
... ...
@@ -4,6 +4,17 @@
4 4
 # 
5 5
 # Run dirpersiststore in ~/.zlogout
6 6
 
7
+dirpersistinstall () {
8
+    if grep -qL 'dirpersiststore' ~/.zlogout; then
9
+    else
10
+        if read -q \?"Would you like to set up your .zlogout file for use with dirspersist? (y/n) "; then
11
+            echo "# Store dirs stack\n# See ~/.oh-my-zsh/plugins/dirspersist.plugin.zsh\ndirpersiststore" >> ~/.zlogout
12
+        else
13
+            echo "If you don't want this message to appear, remove dirspersist from \$plugins"
14
+        fi
15
+    fi
16
+}
17
+
7 18
 dirpersiststore () {
8 19
     dirs -p | tail -r | perl -ne 'chomp;s/([& ])/\\$1/g ;print "if [ -d $_ ]; then pushd -q $_; fi\n"' > ~/.zdirstore
9 20
 }
... ...
@@ -16,6 +27,8 @@ dirpersistrestore () {
16 16
 
17 17
 DIRSTACKSIZE=10
18 18
 setopt autopushd pushdminus pushdsilent pushdtohome pushdignoredups
19
+
20
+dirpersistinstall
19 21
 dirpersistrestore
20 22
 
21 23
 # Make popd changes permanent without having to wait for logout