directories.zsh 808 Bytes
Newer Older
1
# Changing/making/removing directory
James Cox's avatar
James Cox committed
2
setopt auto_name_dirs
3
4
setopt auto_pushd
setopt pushd_ignore_dups
Toon Claes's avatar
Toon Claes committed
5
setopt pushdminus
6
7
8
9
10
11
12
13
14

alias ..='cd ..'
alias cd..='cd ..'
alias cd...='cd ../..'
alias cd....='cd ../../..'
alias cd.....='cd ../../../..'
alias cd/='cd /'

alias 1='cd -'
Toon Claes's avatar
Toon Claes committed
15
16
17
18
19
20
21
22
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'
23
24
25
26
27
28
29
30

cd () {
  if   [[ "x$*" == "x..." ]]; then
    cd ../..
  elif [[ "x$*" == "x...." ]]; then
    cd ../../..
  elif [[ "x$*" == "x....." ]]; then
    cd ../../../..
Yannik Stein's avatar
Yannik Stein committed
31
32
  elif [[ "x$*" == "x......" ]]; then
    cd ../../../../..
33
34
35
  elif [ -d ~/.autoenv ]; then
    source ~/.autoenv/activate.sh
    autoenv_cd "$@"
36
37
38
39
40
41
42
  else
    builtin cd "$@"
  fi
}

alias md='mkdir -p'
alias rd=rmdir
43
alias d='dirs -v | head -10'