From 5834f62a55888507018690682c3e91f3c6e7d351 Mon Sep 17 00:00:00 2001 From: xeruf <27jf@pm.me> Date: Tue, 21 Sep 2021 20:51:19 +0000 Subject: [PATCH] config/shell: adjust to debian --- .config/shell/debian | 1 + .local/bin/scripts/b | 2 +- .local/bin/scripts/edconf | 6 +++--- .local/bin/scripts/git-ln | 2 +- .zprofile | 2 +- 5 files changed, 7 insertions(+), 6 deletions(-) diff --git a/.config/shell/debian b/.config/shell/debian index 0a93585..d090778 100644 --- a/.config/shell/debian +++ b/.config/shell/debian @@ -1,6 +1,7 @@ which apt >/dev/null || return 0 which fd >/dev/null || alias fd='fdfind' +which bat >/dev/null || alias bat='batcat' addalternative() { sudo update-alternatives --install /usr/bin/$1 $1 "$(which "$1$2")" 1 diff --git a/.local/bin/scripts/b b/.local/bin/scripts/b index b3fedd9..8eb516c 100755 --- a/.local/bin/scripts/b +++ b/.local/bin/scripts/b @@ -14,7 +14,7 @@ tput setaf 4 && $elevate file -E "$last" | ( grep -v --color=never 'directory$' case "$($elevate file --dereference --mime "$last")" in *inode/directory*) tput sgr0 && $(test -x "$last" || echo "sudo") ls -l --color=always --human-readable --group-directories-first --file-type --dereference-command-line --all "$@" | less -XF;; *binary) ;; - *) $elevate bat --style header --force-colorization "$@" | less -XF + *) $elevate bat --style header --color always "$@" | less -XF tput setaf 3 && $elevate stat --format '%A size %sB, birth: %.10w mod %.10y' "$last" ;; esac diff --git a/.local/bin/scripts/edconf b/.local/bin/scripts/edconf index 1c370d5..90fc930 100755 --- a/.local/bin/scripts/edconf +++ b/.local/bin/scripts/edconf @@ -3,9 +3,9 @@ alias dedup='awk '"'"'!a[$0]++'"'" listconf() { - { cat "$conf_cache"; - fd --hidden --type file --size -1m --max-depth 1 . ~; - find "${XDG_CONFIG_HOME:-$HOME/.config}" /etc /var/lib/postgres -maxdepth 4 -follow -type f -readable -exec grep -lI '' {} + 2>/dev/null; } | dedup + { cat "$conf_cache"; + $(which fd || echo fdfind) --hidden --type file --size -1m --max-depth 1 . ~; + find "${XDG_CONFIG_HOME:-$HOME/.config}" /etc /var/lib/postgres /var/lib/pleroma -maxdepth 4 -follow -type f -readable -exec grep -lI '' {} + 2>/dev/null; } | dedup } conf_cache_dir="${XDG_CACHE_HOME:-$HOME/.cache}/edconf" diff --git a/.local/bin/scripts/git-ln b/.local/bin/scripts/git-ln index 85f0465..36e5af2 100755 --- a/.local/bin/scripts/git-ln +++ b/.local/bin/scripts/git-ln @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash set -o pipefail upCount=$(git rev-list --count HEAD...@{push} 2>/dev/null) count=$(expr ${upCount:-0} + 3 \& ${upCount:-0} \> 3 \| 6) diff --git a/.zprofile b/.zprofile index 8d67f03..2da8c23 100644 --- a/.zprofile +++ b/.zprofile @@ -46,7 +46,7 @@ export CONFIG_SHELLS="$XDG_CONFIG_HOME/shell" # environment which nvim >/dev/null && export EDITOR='nvim' || export EDITOR='vim' -export LESS='--RAW-CONTROL-CHARS --ignore-case --incsearch --LONG-PROMPT --jump-target=5' +export LESS="--RAW-CONTROL-CHARS --ignore-case --LONG-PROMPT --jump-target=5 $(test $(less --version | head -1 | cut -f2 -d' ') -ge 590 && echo --incsearch)" export IGNOREDIRS="-x dev -x .sync -x .stfolder -x .git -x .gradle -x .idea -x out -x *build -x dist_newstyle -x generated -x cache -x node_modules" # red stderr test -f "/usr/lib/libstderred.so" && export LD_PRELOAD="/usr/lib/libstderred.so${LD_PRELOAD:+:$LD_PRELOAD}"