this repo has no description
at master 65 lines 1.4 kB view raw
1function cdd() { 2 cd "$(dirname "$1")" 3} 4 5function md() { 6 [[ -z ${1// } ]] && echo "no directory name given" && return 1 7 mkdir -p "$1" && cd "$1" 8} 9 10function repos() { 11 # get a temporary file 12 local evalFile=$(mktemp) 13 command repos "${1}" -eval-file "${evalFile}" "${@:2}" 14 # exec any commands we get 15 eval "$(<"${evalFile}")" 16 rm "${evalFile}" 17} 18 19function kswitch() { 20 # get a temporary file 21 local evalFile=$(mktemp) 22 command kswitch "${1}" -eval-file "${evalFile}" "${@:2}" 23 # exec any commands we get 24 eval "$(<"${evalFile}")" 25 rm "${evalFile}" 26} 27 28function t() { 29 command t -- -i "$@" 30 source /tmp/t_aliases 2>/dev/null 31} 32 33function lfcd() { 34 cd "$(command lf -print-last-dir "$@")" 35} 36 37function wt() { 38 local repo_root=$(git rev-parse --show-toplevel) 39 cd "${repo_root}" 40 41 changes=$(git status --short | wc -l) 42 if (( $changes != 0 )); then 43 git add . && git stash 44 fi 45 46 p="$1" 47 if [[ "${p}" == "$(basename "${p}")" ]]; then 48 p="../${p}" # single element, make it a sibling 49 fi 50 git worktree add "${p}" 51 cd "${p}" 52 53 if (( $changes != 0 )); then 54 git stash apply 55 fi 56} 57 58function colortest () { 59 for i in {0..255} ; do 60 printf "\x1b[48;5;%sm%3d\e[0m " "$i" "$i" 61 if (( i == 15 )) || (( i > 15 )) && (( (i-15) % 6 == 0 )); then 62 printf "\n"; 63 fi 64 done 65}