From 6c39ff7b81d833562f0002f77e80558bfd2a02fe Mon Sep 17 00:00:00 2001 From: Paul Ackersviller Date: Sun, 28 Oct 2007 00:55:56 +0000 Subject: Merge of unposted: maintain pushdignoredups if it was set on entry to the function. --- Functions/Example/pushd | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 Functions/Example/pushd (limited to 'Functions') 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 -- cgit 1.4.1