Enable show-ambiguity
[abe:zshrc.git] / zsh.d / 55-cd
1 # -*- sh -*-
2
3 #-() { cd - }
4 -() { popd "$@" }
5 +() { pushd "$@" }
6 -1 -2 -3 -4 -5 -6 -7 -8 -9 +0 +1 +2 +3 +4 +5 +6 +7 +8 +9() { pushd $0 }
7
8 # Don't type too much
9 alias   cd-='cd -'
10
11 alias    cd..='cd ..'
12 alias    ..='cd ..'
13 alias    ...='cd ../..'
14 alias    ....='cd ../../..'
15 alias -g ..='..'
16 alias -g ...='../..'
17 alias -g ....='../../..'
18
19 # Common typos
20 alias    vf=cd
21 alias    xs=cd
22
23 # autojump support
24 if [[ -r /usr/share/autojump/autojump.sh ]]; then
25     alias j > /dev/null && unalias j
26     .  /usr/share/autojump/autojump.sh
27 fi
28
29 # xd support
30 if whence xd > /dev/null; then
31     function xd() { cd $(command xd "$@") }
32 fi
33
34 # wcd support
35 if whence wcd > /dev/null; then
36     alias wd=wcd
37     function wcd() {
38         wcd.exec "$@"
39         . "${HOME}/bin/wcd.go"
40     }
41 fi
42
43 # Save and restore directory, based on
44 # http://chris-lamb.co.uk/2011/07/30/optimising-directory-navigation-multiple-terminals/
45
46 rcd() {
47     cd "$(cat ~/.zsh/saved_dir)"
48 }
49
50 scd() {
51     echo "$(pwd)" > ~/.zsh/saved_dir
52 }