config/shell: improve LESS coloring and use fzf chunk tiebreaker

This commit is contained in:
xeruf 2022-08-28 22:34:44 +02:00
parent c787da4b2a
commit c9193ef1d7
3 changed files with 15 additions and 14 deletions

View File

@ -40,7 +40,7 @@ yas() {
( cat "$list_cache" 2>/dev/null ||
{ pacman --color=always -Sl "$@"; yay --color=always -Sl aur "$@" } |
sed 's/ [^ ]*unknown-version[^ ]*//' | tee "$list_cache" ) |
yzf 2 --tiebreak=index --preview="cat $preview_cache 2>/dev/null | grep -v 'Querying' | grep . || yay --color always -Si {2} | tee $preview_cache"
yzf 2 --tiebreak=chunk,index --preview="cat $preview_cache 2>/dev/null | grep -v 'Querying' | grep . || yay --color always -Si {2} | tee $preview_cache"
)
if test -n "$pkg"
then echo "Installing $pkg..."
@ -53,7 +53,7 @@ yas() {
# List installed packages into fzf and remove selection
# Tip: use -e to list only explicitly installed packages
yar() {
pkg=$(yay --color=always -Q "$@" | yzf 1 --tiebreak=length --preview="yay --color always -Qli {1} | sed 's/^[^a-z]*m{1}//'")
pkg=$(yay --color=always -Q "$@" | yzf 1 --tiebreak=chunk,length --preview="yay --color always -Qli {1} | sed 's/^[^a-z]*m{1}//'")
if test -n "$pkg"
then echo "Removing $pkg..."
cmd="yay -R --cascade --recursive $pkg"

View File

@ -62,6 +62,8 @@ theme() {
#mozfile=$(find $HOME/.mozilla/firefox/ -maxdepth 2 -name addonStartup.json.lz4 | grep ".test")
case "$theme" in
(light)
export LESS_TERMCAP_md=$'\e[1;34m' # bold
export LESS_TERMCAP_so=$'\e[37m' # bottom indication
export BAT_THEME="OneHalfLight"
konsoleprofile colors="Light"
sed -i 's/#\(include.*\/light-256.theme\)/\1/' "$XDG_CONFIG_HOME/task/taskrc"
@ -78,4 +80,3 @@ theme() {
export THEME=$(cat "$theme_save" 2> /dev/null)
export THEME=${THEME:-$theme_default}
theme $THEME

12
.zshenv
View File

@ -1,7 +1,7 @@
export DATA="$(test -d $HOME/daten && echo $HOME/daten || echo $HOME/data)"
export MUSIC="$DATA/4-media/music"
export BORG_REPO="/mnt/backup/borg"
export BORG_REPO='/mnt/backup/borg'
export BORG_PASSCOMMAND='pass service/device/borg/backup'
# xdg
@ -89,16 +89,16 @@ export DIRS_IGNORE="-x .sync -x .stfolder -x *build -x .git -x .idea -x env -x o
# red stderr
test -f "/usr/lib/libstderred.so" && export LD_PRELOAD="/usr/lib/libstderred.so${LD_PRELOAD:+:$LD_PRELOAD}"
# software config
#export TEXMF=/usr/share/context
export TEXMF=/usr/share/texmf-dist
export KSCRIPT_IDEA_COMMAND=intellij-idea-ultimate-edition
## enable pass extensions
export PASSWORD_STORE_ENABLE_EXTENSIONS="true"
## man
export MANPAGER="less --squeeze-blank-lines +Gg"
export LESS_TERMCAP_mb=$'\e[1;31m' # begin bold
export LESS_TERMCAP_md=$'\e[1;33m' # begin blink
export LESS_TERMCAP_so=$'\e[36m' # bottom blue
export LESS_TERMCAP_us=$'\e[01;37m' # begin underline
export LESS_TERMCAP_md=$'\e[1;32m' # begin blink
export LESS_TERMCAP_so=$'\e[36m' # bottom indication
export LESS_TERMCAP_us=$'\e[4;33m' # begin underline
export LESS_TERMCAP_me=$'\e[0m' # reset bold/blink
export LESS_TERMCAP_se=$'\e[0m' # reset reverse video
export LESS_TERMCAP_ue=$'\e[0m' # reset underline
@ -124,7 +124,7 @@ alt-shift-down:preview-down,alt-shift-up:preview-up,esc:close")
export FZF_HISTDIR="$XDG_STATE_HOME/fzf"
mkdir -p "$XDG_STATE_HOME/fzf"
export FZF_DEFAULT_OPTS="--select-1 --ansi
--tiebreak=end,length --history=$FZF_HISTDIR/history --bind='$FZF_BINDINGS'
--tiebreak=chunk,end,length --history=$FZF_HISTDIR/history --bind='$FZF_BINDINGS'
$($_fzf_latest && echo '--preview-window=60%,border-left --marker=o')"
FD_BASE="fd --hidden --color=always --no-ignore-vcs"
export FZF_DEFAULT_COMMAND="$FD_BASE --type file"