X-Git-Url: https://iankelling.org/git/?a=blobdiff_plain;f=brc;h=5aff8e034848cbbfb816f6cd54d65d2055ecd0e7;hb=51c8b40fd2aac71d29dc9298ca65425725ad1edd;hp=4274d6e968ea3523e8fbb2569abf78bb9eabc8e2;hpb=523b7ff889aaafdcd997d84b2a06744993018e89;p=distro-setup diff --git a/brc b/brc index 4274d6e..5aff8e0 100644 --- a/brc +++ b/brc @@ -7,15 +7,15 @@ # so this can set extdebug and avoid the bash debugger. -if [[ -s /a/bin/errhandle/err ]]; then - # shellcheck source=/a/bin/errhandle/err - source /a/bin/errhandle/err +if [[ -s /a/bin/bash-bear-trap/bash-bear ]]; then + # shellcheck source=/a/bin/bash-bear-trap/bash-bear + source /a/bin/bash-bear-trap/bash-bear # wtf, shellcheck doesn't allow disabling warnings in elifs else # bleh shellcheck can't handle disabling in an elif, so nesting this if. # shellcheck disable=SC2154 # set in .bashrc if [[ -s $bashrc_dir/err ]]; then - # shellcheck source=/a/bin/errhandle/err + # shellcheck source=/a/bin/bash-bear-trap/bash-bear source $bashrc_dir/err fi fi @@ -282,8 +282,8 @@ fi # bash: /usr/share/bashdb/bashdb-main.inc: No such file or directory # bash: warning: cannot start debugger; debugging mode disabled if [[ $SOE ]]; then - if [[ -e /a/bin/errhandle/err ]]; then - source /a/bin/errhandle/err + if [[ -e /a/bin/bash-bear-trap/bash-bear ]]; then + source /a/bin/bash-bear-trap/bash-bear fi fi @@ -561,6 +561,21 @@ bl() { fi done } +# like running cl a +cla() { + local line + mapfile -t lines <~/.cdirs + start=$(( ${#lines[@]} - 1 )) + for (( j=start; j >= 0; j-- )); do + line="${lines[$j]}" + if [[ ! $line || ! -d "$line" || $line == "$PWD" || line == "$HOME" ]]; then + continue + fi + e "$line" + c "$line" + break + done +} ## END functions to change directory better than cd ## # pee do. run args as a command with output copied to syslog. @@ -818,15 +833,15 @@ cf() { caf() { local file -find -L "$@" -type f -not \( -name .svn -prune -o -name .git -prune \ + find -L "$@" -type f -not \( -name .svn -prune -o -name .git -prune \ -o -name .hg -prune -o -name .editor-backups -prune \ -o -name .undo-tree-history -prune \) -printf '%h\0%d\0%p\n' | sort -t '\0' -n \ - | awk -F '\0' '{print $3}' 2>/dev/null | while read -r file; do + | awk -F '\0' '{print $3}' 2>/dev/null | while read -r file; do hr printf "%s\n" "$file" hr cat "$file" -done + done } ccomp cat cf caf @@ -840,7 +855,7 @@ clc() { cx() { chmod +X "$@" - } +} cam() { git commit -am "$*" @@ -1436,6 +1451,18 @@ g() { fi } +# g pipe. like: cmd | emacs. save cmd output to tmp file, then edit. +gp() { + cat &>/a/tmp/gtmp + g "$@" /a/tmp/gtmp + } + +# like cmd &> tempfile; emacs tempfile +gc() { + "$@" &> /a/tmp/gtmp + g /a/tmp/gtmp + } + # force terminal version gn() { g -n "$@" @@ -2030,6 +2057,8 @@ sedi() { sed -i --follow-symlinks "$@" } + + rmstrips() { ssh fencepost head -n 300 /gd/gnuorg/EventAndTravelInfo/rms-current-trips.txt | less } @@ -2181,7 +2210,7 @@ skq() { skgit() { local f for f in $(i s | awk '$1 == "modified:" {print $2}'); do - if [[ $(head -n1 "$f") == '#!/bin/bash'* ]]; then + if istext "$f" && [[ $(head -n1 "$f" 2>/dev/null) == '#!/bin/bash'* ]]; then sk $f ||: fi done @@ -2788,18 +2817,18 @@ vim() { # ls count. usage: pass a directory, get the number of files. # https://unix.stackexchange.com/questions/90106/whats-the-most-resource-efficient-way-to-count-how-many-files-are-in-a-director lsc() { - # shellcheck disable=SC2790 # intentional + # shellcheck disable=SC2790 disable=SC2012 # intentional ls -Uq "$@"|wc -l } # run then notify. close notification after the next prompt. rn() { "$@" - dunstify -u critical "$*" + dunstify -u critical -h string:x-dunst-stack-tag:profanity "$*" _psrun=(dunstctl close-all) } n() { - dunstify -u critical n + dunstify -u critical -h string:x-dunst-stack-tag:profanity n _psrun=(dunstctl close-all) }