1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-10-29 05:21:00 +01:00

Merge of unposted: maintain pushdignoredups if it was set on entry to the function.

This commit is contained in:
Paul Ackersviller 2007-10-28 00:55:56 +00:00
parent 790cc92ac7
commit 6c39ff7b81

17
Functions/Example/pushd Normal file
View file

@ -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