dirpersist.plugin.zsh 527 Bytes
Newer Older
1
2
3
4
5
6
7
#!/bin/zsh
# 
# Make the dirstack more persistant
# 
# Run dirpersiststore in ~/.zlogout

dirpersiststore () {
8
    dirs -p | tail -r | perl -ne 'chomp;s/([& ])/\\$1/g ;print "if [ -d $_ ]; then pushd -q $_; fi\n"' > ~/.zdirstore
9
10
11
12
13
14
15
16
17
18
}

dirpersistrestore () {
    if [ -f ~/.zdirstore ]; then
        source ~/.zdirstore
    fi
}

DIRSTACKSIZE=10
setopt autopushd pushdminus pushdsilent pushdtohome pushdignoredups
19
20
21
dirpersistrestore

# Make popd changes permanent without having to wait for logout
22
alias popd="popd;dirpersiststore"