darkrc/bin/cd-improved

20 lines
290 B
Bash

#!/bin/sh
root="$(git rev-parse --show-toplevel 2>/dev/null)"
if [ -z "$root" ]
then
builtin cd "$@"
else
if [ -z "$1" ]
then
builtin cd "$root"
else
if [ $(echo "$1" | grep '^/') ]
then builtin cd "$root"$@
else builtin cd "$@"
fi
fi
fi
source smartprompt