projects
/
grml-etc-core.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
5f0f906
)
zshrc: provide smart cd function, allows switching to /etc when running 'cd /etc...
author
Michael Prokop
<mika@grml.org>
Sun, 24 Jul 2011 11:47:06 +0000
(13:47 +0200)
committer
Michael Prokop
<mika@grml.org>
Sun, 24 Jul 2011 13:23:43 +0000
(15:23 +0200)
etc/zsh/zshrc
patch
|
blob
|
history
diff --git
a/etc/zsh/zshrc
b/etc/zsh/zshrc
index
d5bbfa0
..
cf20ca7
100644
(file)
--- a/
etc/zsh/zshrc
+++ b/
etc/zsh/zshrc
@@
-2655,6
+2655,17
@@
fir() {
firefox -a firefox -remote "openURL($1)" || firefox ${1}&
fi
}
+# smart cd function, allows switching to /etc when running 'cd /etc/fstab'
+cd() {
+ if [[ -f ${1} ]]; then
+ [[ ! -e ${1:h} ]] && return 1
+ print "Correcting ${1} to ${1:h}"
+ builtin cd ${1:h}
+ else
+ builtin cd ${1}
+ fi
+}
+
#f5# Create Directoy and \kbd{cd} to it
mcd() {
mkdir -p "$@" && cd "$@"