config/zsh: move from z to zoxide & restyle less

This commit is contained in:
xeruf 2021-07-02 18:32:09 +02:00
parent a2575d20bd
commit 986dc4ff1c
3 changed files with 29 additions and 25 deletions

View File

@ -9,8 +9,13 @@ alias -g XC="| xclip -selection clipboard"
alias -g L="--color=always | ${PAGER:-less}"
fi
alias h='help'
alias info='info --vi-keys'
alias c=z
alias d=z
alias v=edit
xdh="$XDG_DATA_HOME"
xch="$XDG_CONFIG_HOME"
if test -d "$DATA"; then
@ -35,17 +40,19 @@ rd() {
}
rr() { mv "$@" /tmp }
calc='rlwrap -a bc -l'
alias j='jrnl'
jn() { jrnl -to today "$@" | bat --style=plain --pager="less +G" }
alias jnc='jn -contains'
# like "which", but shows contents if it resolves to a file
wh() {
res=$(which "$@")
test -r "$res" && b --plain "$res" || echo "$res"
test -r "$res" && b --style=numbers,header "$res" || echo "$res"
}
compdef wh=which
alias calc='rlwrap -a bc -l'
alias j='jrnl'
jn() { jrnl -to today "$@" | bat --style=plain --pager="less +G" }
compdef jn=jrnl
alias jnc='jn -contains'
alias logoff="loginctl terminate-user $USER"
@ -131,10 +138,6 @@ alias tw='timew'
twsm() { timew summary $(date --date="Monday $1 week ago" -I) to tomorrow :ids ${@:2} }
alias twtest='( cp -r "$TIMEWARRIORDB" /tmp/tw-bak && TIMEWARRIORDB=/tmp/timewarriordb-test/$(date +%s) && mkdir -p "$TIMEWARRIORDB"/data && :> "$TIMEWARRIORDB"/timewarrior.cfg && $SHELL )'
# Quick shortcuts
alias c='clear'
alias v='edit'
alias lst='( last; last -f /var/log/wtmp.1 ) | grep -v "pts/" | tac | less +G'
alias lar='last | tac'
@ -169,7 +172,6 @@ alias uloc="noglob sudo updatedb && $__loci"
alias syslog='less +F /var/log/syslog'
alias println='printf "\n"'
alias graphics='lspci -vnn | grep VGA --color=never && xrandr --listproviders'
alias vlch="vlc -H | ${PAGER:-less}"
alias usergroups="cat /etc/passwd | cut -d':' -f1 | xargs -n 1 id"
alias omd="(echo '#+OPTIONS: tags:nil'; xclip -o -selection clipboard) | pandoc -f org-auto_identifiers -t markdown --wrap preserve | xclip -filter"
alias mdo="pandoc -f gfm-ascii_identifiers-gfm_auto_identifiers -t org --wrap preserve"
@ -220,11 +222,6 @@ test -d $HOME/.dropbox && dropbox_path="$(cat $HOME/.dropbox/info.json | grep -P
alias alert='notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo error)" "$(echo "$history[$HISTCMD]" | sed -e '\''s/^\s*[0-9]\+\s*//;s/[;&|]\s*alert$//'\'')"'
#fi
# Find zmv in man because I need to look it up all the time ^^
man() {
(test "$1" = "zmv" && LESS="$LESS+/^ *zmv *\\[" /usr/bin/man zshcontrib) || /usr/bin/man "$@"
}
sedcomment() { sed -i 's/$1/#\0/' "${@:2}" }
seduncomment() { sed -i 's/#\($1\)/\0/' "${@:2}" }

View File

@ -39,7 +39,6 @@ plugins=(
#git
gitfast
#git-auto-fetch
z
fast-syntax-highlighting
zsh-autosuggestions
zsh-vim-mode
@ -54,8 +53,6 @@ ZSH_DISABLE_COMPFIX=true
source $ZSH/oh-my-zsh.sh
compdef wh=which
## Functions
tab_list_files() {
@ -183,6 +180,8 @@ test -s $CONFIG_ZSH/.p10k.zsh && source $CONFIG_ZSH/.p10k.zsh
test -d /usr/share/fzf && source /usr/share/fzf/key-bindings.zsh && source /usr/share/fzf/completion.zsh
eval "$(zoxide init zsh)"
test -f $XDG_CONFIG_HOME/broot/launcher/bash/br && source $XDG_CONFIG_HOME/broot/launcher/bash/br
# Nix

View File

@ -32,7 +32,6 @@ export TASKRC="$XDG_CONFIG_HOME/task/taskrc"
export TASKDATA="$XDG_DATA_HOME/task"
# zsh dirs
export ZDOTDIR="$XDG_CONFIG_HOME/zsh"
export _Z_DATA="$XDG_DATA_HOME/zsh/z"
export HISTFILE="$XDG_DATA_HOME/zsh/history"
# ccache - can be removed with version 4 - https://github.com/ccache/ccache/issues/191
export CCACHE_CONFIGPATH="$XDG_CONFIG_HOME"/ccache.config
@ -41,14 +40,23 @@ export CCACHE_DIR="$XDG_CACHE_HOME"/ccache
# environment
export IGNOREDIRS=".sync,.stfolder,.git,out,build,dev"
export EDITOR=/usr/bin/nvim
export MANPAGER="sh -c 'col -bx | bat -l man -p'"
export LESS='--RAW-CONTROL-CHARS --ignore-case --incsearch'
# red stderr
test -f "/usr/lib/libstderred.so" && export LD_PRELOAD="/usr/lib/libstderred.so${LD_PRELOAD:+:$LD_PRELOAD}"
# software config
# enable pass extensions
## enable pass extensions
export PASSWORD_STORE_ENABLE_EXTENSIONS="true"
# fzf defaults
## 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_me=$'\e[0m' # reset bold/blink
export LESS_TERMCAP_se=$'\e[0m' # reset reverse video
export LESS_TERMCAP_ue=$'\e[0m' # reset underline
export GROFF_NO_SGR=1 # for konsole and gnome-terminal
## fzf defaults
FZF_BINDINGS=$(echo '
change:top
alt-enter:execute(test -O {} && $EDITOR {} || sudoedit {})
@ -70,7 +78,7 @@ export FZF_DEFAULT_OPTS="--select-1 --ansi --marker=o
FD_BASE="fd --hidden --color=always --no-ignore-vcs"
export FZF_DEFAULT_COMMAND="$FD_BASE --type file"
export FZF_CTRL_T_COMMAND="$FD_BASE -d 7"
# ctest
## ctest
export CTEST_PROGRESS_OUTPUT=1
export CTEST_OUTPUT_ON_FAILURE=1
export CTEST_PARALLEL_LEVEL=3