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 | 8a81d1527238209b7282a7887bf801e0b4830bab (patch) | |
tree | a83869332fe68fb30129825fbbe3049a52cf58c8 | |
parent | Add The Fifth Season (diff) | |
download | src-8a81d1527238209b7282a7887bf801e0b4830bab.tar.gz src-8a81d1527238209b7282a7887bf801e0b4830bab.zip |
Allow cd-ing into a file
Diffstat (limited to '')
-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" |