X-Git-Url: https://iankelling.org/git/?a=blobdiff_plain;f=brc;h=d17c1a132e70ee4b7bc0f3f01bc39210ccf7f6bb;hb=3fb3cc1b27a2ab661a4b46a36dd2114ce96020a4;hp=6389c8763dc249881d010b671daf10894d66febe;hpb=63e3670ab59869f5f74904edbe64daa943fad15f;p=distro-setup diff --git a/brc b/brc index 6389c87..d17c1a1 100644 --- a/brc +++ b/brc @@ -279,6 +279,15 @@ mysrc() { mysrc /a/bin/small-misc-bash/ll-function mysrc /a/bin/distro-functions/src/package-manager-abstractions +# things to remember: +# ALT-C - cd into the selected directory +# CTRL-T - Paste the selected file path into the command line +# +# good guide to some of its basic features is the readme file +# https://github.com/junegunn/fzf +if [[ -s /usr/share/doc/fzf/examples/key-bindings.bash ]]; then + source /usr/share/doc/fzf/examples/key-bindings.bash +fi # * functions @@ -867,6 +876,8 @@ ccomp bg d z() { builtin fg "$@"; } ccomp fg z +x() { builtin kill %%; } + dc() { diff --strip-trailing-cr -w "$@" # diff content } @@ -1009,6 +1020,9 @@ etail2() { ccomp tail etail etail2 +showkeys() { + ssh "$@" cat .ssh/authorized_keys{,2} +} # print exim old pids @@ -1113,6 +1127,20 @@ faf() { # find all files. use -L to follow symlinks -o -name .undo-tree-history -prune \) -type f 2>/dev/null } +# usage ffconcat FILES_TO_CONCAT OUTPUT_FILE +ffconcat() { + local tmpf + tmpf=$(mktemp) + printf "file '%s'\n" "$1" >$tmpf + while (( $# > 1 )); do + shift + printf "file '%s'\n" "$1" >>$tmpf + done + # https://trac.ffmpeg.org/wiki/Concatenate + ffmpeg -f concat -safe 0 -i $tmpf -c copy "$1" + rm $tmpf +} + # full path without resolving symlinks fp() { local dir base @@ -2554,6 +2582,10 @@ if [[ $- == *i* ]]; then if [[ $MAIL_HOST && $MAIL_HOST != "$HOSTNAME" ]]; then ps_char="@ $ps_char" fi + jobs_char= + if [[ $(jobs -p) ]]; then + jobs_char='\j ' + fi # We could test if sudo is active with sudo -nv # but then we get an email and log of lots of failed sudo commands. # We could turn those off, but seems better not to. @@ -2563,7 +2595,7 @@ if [[ $- == *i* ]]; then if [[ ! $HISTFILE ]]; then ps_char="NOHIST $ps_char" fi - PS1="${PS1%"${PS1#*[wW]}"} $psudo\[$ps_color\]$ps_char\[$term_nocolor\] " + PS1="${PS1%"${PS1#*[wW]}"} $jobs_char$psudo\[$ps_color\]$ps_char\[$term_nocolor\] " # set titlebar. instead, using more advanced # titelbar below @@ -2579,18 +2611,22 @@ if [[ $- == *i* ]]; then _title_escape="\033]0;" fi + # make the titlebar be the last command and the current directory. settitle () { - # this makes it so we show the current command if - # one is running, otherwise, show nothing - if [[ $1 == prompt-command ]]; then + + # These are some checks to help ensure we dont set the title at + # times that the debug trap is running other than the case we + # want. Some of them might not be needed. + if (( ${#FUNCNAME[@]} != 1 || ${#BASH_ARGC[@]} != 2 || $BASH_SUBSHELL != 0 )); then return 0 fi - if (( ${#BASH_ARGC[@]} == 1 && BASH_SUBSHELL == 0 )); then - echo -ne "$_title_escape ${PWD/#$HOME/~} " - printf "%s" "$*" - echo -ne "\007" + if [[ $1 == prompt-command ]]; then + return 0 fi + echo -ne "$_title_escape ${PWD/#$HOME/~} " + printf "%s" "$*" + echo -ne "\007" } # note, this wont work: