diff options
author | Paul Ackersviller <packersv@users.sourceforge.net> | 2007-10-28 00:55:56 +0000 |
---|---|---|
committer | Paul Ackersviller <packersv@users.sourceforge.net> | 2007-10-28 00:55:56 +0000 |
commit | 6c39ff7b81d833562f0002f77e80558bfd2a02fe (patch) | |
tree | 843923baee22508142233d5f8f6e201abfbbf83b /Functions | |
parent | 790cc92ac73370c42e0aa0308d134be689ab35ce (diff) | |
download | zsh-6c39ff7b81d833562f0002f77e80558bfd2a02fe.tar.gz zsh-6c39ff7b81d833562f0002f77e80558bfd2a02fe.tar.xz zsh-6c39ff7b81d833562f0002f77e80558bfd2a02fe.zip |
Merge of unposted: maintain pushdignoredups if it was set on entry to the function.
Diffstat (limited to 'Functions')
-rw-r--r-- | Functions/Example/pushd | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/Functions/Example/pushd b/Functions/Example/pushd new file mode 100644 index 000000000..bb020c0aa --- /dev/null +++ b/Functions/Example/pushd @@ -0,0 +1,17 @@ +# pushd function to emulate the old zsh behaviour. With this function +# pushd +/-n just lifts the selected element to the top of the stack +# instead of just cycling the stack. + +local puid +[[ -o pushdignoredups ]] && puid=1 + +emulate -R zsh +setopt localoptions + +if [[ ARGC -eq 1 && "$1" == [+-]<-> ]] then + setopt pushdignoredups + builtin pushd ~$1 +else + [[ -n $puid ]] && setopt pushdignoredups + builtin pushd "$@" +fi |