diff options
author | Florian Pritz <bluewind@xinu.at> | 2018-07-05 20:53:14 +0200 |
---|---|---|
committer | Florian Pritz <bluewind@xinu.at> | 2018-07-05 20:53:14 +0200 |
commit | 6c7769112eaa213c09d412a8dba51e59f2240bea (patch) | |
tree | 7bf2f7955568622b71bc7ef3b1e7de23d2e82b40 | |
parent | 5aeb17165ffce38c2956f255b792d54fb534e7dc (diff) | |
download | dotfiles-6c7769112eaa213c09d412a8dba51e59f2240bea.tar.gz dotfiles-6c7769112eaa213c09d412a8dba51e59f2240bea.tar.xz |
zshrc: Add cd $file correction
Signed-off-by: Florian Pritz <bluewind@xinu.at>
-rw-r--r-- | .zshrc | 10 |
1 files changed, 10 insertions, 0 deletions
@@ -297,6 +297,16 @@ SPROMPT='zsh: correct '%R' to '%r' ? ([Y]es/[N]o/[E]dit/[A]bort) ' # }}} # Functions {{{ +function cd () { + if (( ${#argv} == 1 )) && [[ -f ${1} ]]; then + [[ ! -e ${1:h} ]] && return 1 + print "Correcting ${1} to ${1:h}" + builtin cd ${1:h} + else + builtin cd "$@" + fi +} + sv() { vim "sudo:$1" } |