1862b1c0755770cffcbcb936bdecc3bfb050931d

Author
Matt Cable <wozz@wookie.net>
Committer
Matt Cable <wozz@wookie.net>
Date

Message

Added installation function

Diff

 1diff --git a/plugins/dirpersist.plugin.zsh b/plugins/dirpersist.plugin.zsh
 2index d694c55e244e15d2c7864f821298ac6220df797b..48ca94d7c6ca64d3d38133ef38696eb0315c305e 100644
 3--- a/plugins/dirpersist.plugin.zsh
 4+++ b/plugins/dirpersist.plugin.zsh
 5@@ -4,6 +4,17 @@
 6 # 
 7 # Run dirpersiststore in ~/.zlogout
 8 
 9+dirpersistinstall () {
10+    if grep -qL 'dirpersiststore' ~/.zlogout; then
11+    else
12+        if read -q \?"Would you like to set up your .zlogout file for use with dirspersist? (y/n) "; then
13+            echo "# Store dirs stack\n# See ~/.oh-my-zsh/plugins/dirspersist.plugin.zsh\ndirpersiststore" >> ~/.zlogout
14+        else
15+            echo "If you don't want this message to appear, remove dirspersist from \$plugins"
16+        fi
17+    fi
18+}
19+
20 dirpersiststore () {
21     dirs -p | tail -r | perl -ne 'chomp;s/([& ])/\\$1/g ;print "if [ -d $_ ]; then pushd -q $_; fi\n"' > ~/.zdirstore
22 }
23@@ -16,6 +27,8 @@ dirpersistrestore () {
24 
25 DIRSTACKSIZE=10
26 setopt autopushd pushdminus pushdsilent pushdtohome pushdignoredups
27+
28+dirpersistinstall
29 dirpersistrestore
30 
31 # Make popd changes permanent without having to wait for logout