From 1689909e66f73f779c4e13458d713a2ef517c9f5 Mon Sep 17 00:00:00 2001 From: Ian Kelling Date: Sat, 27 Apr 2024 18:49:03 -0400 Subject: [PATCH] strip out terminals that require gpu accel --- brc | 76 ++++++++++++++++++++++++++++++++++--------------------------- 1 file changed, 42 insertions(+), 34 deletions(-) diff --git a/brc b/brc index 2fbce55..3f4d9f9 100644 --- a/brc +++ b/brc @@ -248,30 +248,12 @@ if [[ $- == *i* ]]; then TERM=xterm-256color fi - if [[ $TERM == alacritty && ! -e /usr/share/terminfo/a/alacritty ]]; then - # todo: we should try installing the alacritty terminfo if it is not found - # https://github.com/alacritty/alacritty/issues/2838 - TERM=xterm-256color - fi - - # copying from the alacritty example above, - if [[ $TERM == xterm-kitty ]]; then - if [[ ! -e /usr/share/terminfo/x/xterm-kitty ]]; then - TERM=xterm-256color - else - if [[ -e /a/opt/kitty/shell-integration/bash/kitty.bash ]]; then - KITTY_SHELL_INTEGRATION=t - source /a/opt/kitty/shell-integration/bash/kitty.bash - fi - fi - fi - # todo: not sure this works in sakura #stty werase undef #bind "\C-w": kill-region # sakura == xterm-256color # konsole == xterm - if [[ $TERM != xterm-kitty && $TERM == xterm* ]]; then + if [[ $TERM == xterm* ]]; then # control + arrow keys. for other terminals, see http://unix.stackexchange.com/questions/10806/how-to-change-previous-next-word-shortcut-in-bash bind '"\e[1;5C": shell-forward-word' 2>/dev/null bind '"\e[1;5D": shell-backward-word' 2>/dev/null @@ -291,15 +273,6 @@ if [[ $- == *i* ]]; then fi -case $TERM in - # fixup broken backspace in chroots - xterm-kitty|alacritty) - chroot() { - TERM=xterm-256color command chroot "$@" - } - ;; -esac - export BC_LINE_LENGTH=0 # ansible option @@ -2484,15 +2457,54 @@ skq() { shellcheck -W 999 -x -e $others "$@" || return $? } -skgit() { +# sk on all modified files in current git repo +skmodified() { local f for f in $(i s | awk '$1 == "modified:" {print $2}'); do + if [[ ! -L $f ]] && istext "$f" && [[ $(head -n1 "$f" 2>/dev/null) == '#!/bin/bash'* ]]; then + sk $f ||: + fi + done +} + +# sk on all the files in current git repo (except those excluded) +skgit() { + local f toplevel orig_dir tmp skip e + local -a ls_files excludes + toplevel=$(git rev-parse --show-toplevel) + if [[ $PWD != "$toplevel" ]]; then + orig_dir=$PWD + cd $toplevel + fi + excludes=( + 'disabled/*' + # included from another file and checked there + beet-data + brc + brc2 + ) + tmp=$(git ls-files) + mapfile -t ls_files <<<"$tmp" + for f in "${ls_files[@]}"; do + skip=false + for e in "${excludes[@]}"; do + if [[ $f == $e ]]; then + skip=true + break + fi + done + if $skip; then continue; fi + if istext "$f" && [[ $(head -n1 "$f" 2>/dev/null) == '#!/bin/bash'* ]]; then sk $f ||: fi done + if [[ $orig_dir ]]; then + cd $orig_dir + fi } + # sl: ssh, but firsh rsync our bashrc and related files to a special # directory on the remote host if needed. @@ -2737,11 +2749,7 @@ ssk() { ccomp ssh sl slr sss ssk # plain ssh ssh() { - if [[ $TERM == alacritty || $TERM == xterm-kitty ]]; then - TERM=xterm-256color LC_USEBASHRC=t command ssh "$@" - else - LC_USEBASHRC=t command ssh "$@" - fi + LC_USEBASHRC=t command ssh "$@" } -- 2.30.2