This repository has been archived on 2022-03-28. You can view files and clone it, but cannot push or open issues or pull requests.
prezto/functions/directory.zsh

39 lines
959 B
Bash

setopt auto_cd # Auto cd to a directory without typing cd.
setopt auto_pushd # Push the old directory onto the stack on cd.
setopt pushd_ignore_dups # Don't store duplicates in the stack.
setopt cdable_vars # Change directory to a path stored in a variable.
setopt auto_name_dirs # Auto add variable-stored paths to ~ list.
setopt multios # Write to multiple descriptors.
alias ..='cd ..'
alias cd..='cd ..'
alias cd...='cd ../..'
alias cd....='cd ../../..'
alias cd.....='cd ../../../..'
alias cd/='cd /'
alias 1='cd -'
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'
cd () {
if [[ "x$*" == "x..." ]]; then
cd ../..
elif [[ "x$*" == "x...." ]]; then
cd ../../..
elif [[ "x$*" == "x....." ]]; then
cd ../../..
elif [[ "x$*" == "x......" ]]; then
cd ../../../..
else
builtin cd "$@"
fi
}