diff options
author | NanoTech <nanotech008@gmail.com> | 2010-10-19 15:39:27 -0600 |
---|---|---|
committer | NanoTech <nanotech008@gmail.com> | 2010-10-19 15:39:27 -0600 |
commit | 68f893cbe05e5a84adf7f26a0ed7492af6e03def (patch) | |
tree | 81b436518d3552f47a02f44963e84700627d1bec /plugins/dirpersist | |
parent | 02c5fd5bdd0d37bb0e1cb19ad058154f5b7d96a7 (diff) | |
parent | dc12853b0c3e5af9e42f44cb9efdf57d44d20711 (diff) | |
download | zsh-68f893cbe05e5a84adf7f26a0ed7492af6e03def.tar.gz zsh-68f893cbe05e5a84adf7f26a0ed7492af6e03def.tar.bz2 zsh-68f893cbe05e5a84adf7f26a0ed7492af6e03def.zip |
Merge branch 'master' of git://github.com/robbyrussell/oh-my-zsh
Diffstat (limited to 'plugins/dirpersist')
-rw-r--r-- | plugins/dirpersist/dirpersist.plugin.zsh | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/plugins/dirpersist/dirpersist.plugin.zsh b/plugins/dirpersist/dirpersist.plugin.zsh new file mode 100644 index 000000000..6a2b289a2 --- /dev/null +++ b/plugins/dirpersist/dirpersist.plugin.zsh @@ -0,0 +1,39 @@ +#!/bin/zsh +# +# Make the dirstack more persistant +# +# Add dirpersist to $plugins in ~/.zshrc to load +# + +# $zdirstore is the file used to persist the stack +zdirstore=~/.zdirstore + +dirpersistinstall () { + if grep 'dirpersiststore' ~/.zlogout > /dev/null; then + else + if read -q \?"Would you like to set up your .zlogout file for use with dirspersist? (y/n) "; then + echo "# Store dirs stack\n# See ~/.oh-my-zsh/plugins/dirspersist.plugin.zsh\ndirpersiststore" >> ~/.zlogout + else + echo "If you don't want this message to appear, remove dirspersist from \$plugins" + fi + fi +} + +dirpersiststore () { + dirs -p | perl -e 'foreach (reverse <STDIN>) {chomp;s/([& ])/\\$1/g ;print "if [ -d $_ ]; then pushd -q $_; fi\n"}' > $zdirstore +} + +dirpersistrestore () { + if [ -f $zdirstore ]; then + source $zdirstore + fi +} + +DIRSTACKSIZE=10 +setopt autopushd pushdminus pushdsilent pushdtohome pushdignoredups + +dirpersistinstall +dirpersistrestore + +# Make popd changes permanent without having to wait for logout +alias popd="popd;dirpersiststore" |