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:
parent
790cc92ac7
commit
6c39ff7b81
1 changed files with 17 additions and 0 deletions
17
Functions/Example/pushd
Normal file
17
Functions/Example/pushd
Normal 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
|
||||
Loading…
Add table
Add a link
Reference in a new issue