mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-03-10 00:05:30 +08:00
use loop to create aliases for dir stack
If DIRSTACKSIZE is set, create alias for each stack entry. if DIRSTACKSIZE is not set, create same as previous hard coded method.
This commit is contained in:
@@ -9,16 +9,13 @@ alias -g .....='../../../..'
|
||||
alias -g ......='../../../../..'
|
||||
|
||||
alias -- -='cd -'
|
||||
alias 1='cd -1'
|
||||
alias 2='cd -2'
|
||||
alias 3='cd -3'
|
||||
alias 4='cd -4'
|
||||
alias 5='cd -5'
|
||||
alias 6='cd -6'
|
||||
alias 7='cd -7'
|
||||
alias 8='cd -8'
|
||||
alias 9='cd -9'
|
||||
|
||||
local n lim
|
||||
[[ -v DIRSTACKSIZE ]] && lim=$DIRSTACKSIZE || lim=9
|
||||
for n in {1..$lim}; do
|
||||
alias $n="cd -$n"
|
||||
done
|
||||
|
||||
alias md='mkdir -p'
|
||||
alias rd=rmdir
|
||||
|
||||
|
||||
Reference in New Issue
Block a user