diff options
author | June McEnroe <june@causal.agency> | 2019-12-05 10:10:13 -0500 |
---|---|---|
committer | June McEnroe <june@causal.agency> | 2019-12-05 10:10:13 -0500 |
commit | d398e5b54b0771a67bdfbba3cbe641068dfba97c (patch) | |
tree | bee02355a2c7dbb694050255b8d17f09cb1e0e51 /home | |
parent | Add The Fifth Season (diff) | |
download | src-d398e5b54b0771a67bdfbba3cbe641068dfba97c.tar.gz src-d398e5b54b0771a67bdfbba3cbe641068dfba97c.zip |
Allow cd-ing into a file
Diffstat (limited to 'home')
-rw-r--r-- | home/.shrc | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/home/.shrc b/home/.shrc index 45b2fe62..b864018b 100644 --- a/home/.shrc +++ b/home/.shrc @@ -18,6 +18,16 @@ alias rand='openssl rand -base64 33' alias private='eval "$(gpg -d ~/.private)"' bman() { ssh ${freebsd:-monday} man "$@" | sh -c "$MANPAGER"; } +cd() { + if [ $# -eq 0 ]; then + builtin cd + elif [ -e "$1" -a ! -d "$1" ]; then + builtin cd "${1%/*}" && $EDITOR "${1##*/}" + else + builtin cd "$@" + fi +} + PS0=$'\n' PS1='\$ ' RPS1="\? ${SSH_CLIENT:+\h:}\w" |