function cdd() { cd "$(dirname "$1")" } function md() { [[ -z ${1// } ]] && echo "no directory name given" && return 1 mkdir -p "$1" && cd "$1" } function repos() { # get a temporary file local evalFile=$(mktemp) command repos "${1}" -eval-file "${evalFile}" "${@:2}" # exec any commands we get eval "$(<"${evalFile}")" rm "${evalFile}" } function kswitch() { # get a temporary file local evalFile=$(mktemp) command kswitch "${1}" -eval-file "${evalFile}" "${@:2}" # exec any commands we get eval "$(<"${evalFile}")" rm "${evalFile}" } function t() { command t -- -i "$@" source /tmp/t_aliases 2>/dev/null } function lfcd() { cd "$(command lf -print-last-dir "$@")" } function wt() { local repo_root=$(git rev-parse --show-toplevel) cd "${repo_root}" changes=$(git status --short | wc -l) if (( $changes != 0 )); then git add . && git stash fi p="$1" if [[ "${p}" == "$(basename "${p}")" ]]; then p="../${p}" # single element, make it a sibling fi git worktree add "${p}" cd "${p}" if (( $changes != 0 )); then git stash apply fi } function colortest () { for i in {0..255} ; do printf "\x1b[48;5;%sm%3d\e[0m " "$i" "$i" if (( i == 15 )) || (( i > 15 )) && (( (i-15) % 6 == 0 )); then printf "\n"; fi done }