X-Git-Url: https://www.fleuret.org/cgi-bin/gitweb/gitweb.cgi?p=scripts.git;a=blobdiff_plain;f=bashrc;h=93b9e5642a444eeeec88d0a3b449efc7b26c3920;hp=d16c2ca95bfcfccece29389d8dcdd46ef04327e5;hb=HEAD;hpb=12b8b183fd2530b15c4a5620ac5bd26220d99479 diff --git a/bashrc b/bashrc index d16c2ca..93b9e56 100644 --- a/bashrc +++ b/bashrc @@ -58,7 +58,7 @@ shopt -s autocd ###################################################################### # added by Miniconda3 installer -export PATH="/home/fleuret/conda/bin:$PATH" +export PATH="${HOME}/conda/bin:$PATH" [ ${TERM} == "dumb" ] || [[ ! -t 0 ]] && return @@ -140,8 +140,12 @@ function ext () { find . -maxdepth 1 -type f | \grep \. | sed -e 's/^.*\.\([^/.]*\)$/\1/' } -function obs () { - dir=${HOME}/misc/use-by-$(date --date='+3 months' +%Y-%b-%d) +# function catscan () { + # convert signal-attachment-2020-06-01-192843.jpeg signal-attachment-2020-06-01-192829.jpeg -quality 25 -sigmoidal-contrast 10,45% -page a4 scan.pdf +# } + +function trash-later () { + dir=${HOME}/misc/trash-later/remove-after-$(date --date='+3 months' +%Y-%b-%d) mkdir -p "${dir}" pushd "${dir}" } @@ -444,15 +448,16 @@ alias a='cd /tmp/at' function trash () { - [[ "${TRASH_ROOT}" ]] || TRASH_ROOT="${HOME}/.trash" + [[ "${TRASH_LATER_ROOT}" ]] || TRASH_LATER_ROOT="${HOME}/.trash" if [[ "$1" == "--" ]] then shift - elif [[ "$1" == "-t" ]] + elif [[ "$1" == "-l" ]] then shift - TRASH_DIR="${TRASH_ROOT}" + echo "Trashin in 3 months" + TRASH_DIR="${TRASH_LATER_ROOT}/remove-after-$(date --date='+3 months' +%Y-%b-%d)" mkdir -p "${TRASH_DIR}" else TRASH_DIR=$(date +/tmp/trash-${USER}-%Y-%b-%d-%Hh) @@ -543,7 +548,7 @@ function netup () { return 0 fi - if \ifconfig -s | grep -q -v ^'(Iface|lo) ' + if \ifconfig -s | grep -q -v ^'(Iface|lo|docker[0-9]) ' then echo "There is/are already interface(s) up." >&2 return 1 @@ -814,7 +819,7 @@ function ripdvd () { return 1 fi - echo "Attemptin to rip from ${DVD_DEVICE}." + echo "Attempting to rip from ${DVD_DEVICE}." mkdir -p ${HOME}/dvds @@ -903,6 +908,20 @@ function mvtoconfig () { fi } + +###################################################################### +# git prompt + +if which > /dev/null git +then + + parse_git_branch() { + git 2>/dev/null rev-parse --abbrev-ref HEAD | sed -e 's/^\(.*\)$/(\1) /' + } + + export PS_GIT="${VT_GREEN_FG}\$(parse_git_branch)" +fi + ###################################################################### # The complex prompt policy @@ -933,6 +952,8 @@ else [[ "${IDENT}" ]] && IDENT="${IDENT}:" + # IDENT="${PS_GIT}${VT_BLACK_FG}${IDENT}" + if [[ ${USER} == "root" ]] then # If we are root, show that in red @@ -950,7 +971,7 @@ else fi -PS1="${PSCUE}${PS1}" +#PS1="${PSCUE}${PS1}" ###################################################################### # This implements a local history. If we are in a directory containing