1
0
Fork 0

shells: some cleanup for bash and zsh

This commit is contained in:
Von Random 2025-03-04 14:00:46 +02:00
parent ebf583cb5a
commit e898af0e0d
4 changed files with 8 additions and 43 deletions

View file

@ -1,22 +1,6 @@
# Fuck default aliases
unalias -a
function termcompat {
typeset term=$TERM
case $term in
(alacritty*) ;&
(kitty*) ;&
(wezterm) ;&
(xterm-*)
term=xterm;;
(rxvt-unicode*)
term=rxvt-unicode;;
(tmux*)
term=screen.xterm-new;;
esac
TERM=$term command $@
}
function addpath {
typeset newpath=$1
if [[ ! $PATH =~ $newpath ]]; then
@ -25,22 +9,13 @@ function addpath {
fi
}
function fsf {
typeset host prompt="SSH Remote > "
host=$(cut -d\ -f1 $HOME/.ssh/known_hosts | sort -u | fzf --prompt=$prompt) || return 1
termcompat ssh $host $@
}
function beep { printf $'\007' }
function fixterm { printf $'\u001bc' }
function testbin { whence $@ > /dev/null }
function cm { command chezmoi $@ }
function diff { command diff --color $@ }
function tailf { command less +F $@ }
function grep { command grep --color=auto $@ }
function rgrep { grep --exclude-dir=.git -R $@ }
function s { termcompat ssh $@ }
function zj { command zellij $@ }
function tmux { command tmux -2 $@ }

View file

@ -7,10 +7,11 @@ SAVEHIST=10000
HISTSIZE=10000
HISTFILE=$HOME/.histfile.$UID
EDITOR=vim
whence hx >/dev/null && EDITOR=hx
for editor in hx nvim vim vi; do
testbin $editor && break
done
export EDITOR
export EDITOR=$editor
export LESS='i M R'
export PAGER=less
export TIME_STYLE=long-iso
@ -42,8 +43,6 @@ zstyle ':completion:*:kill:*:processes' command 'ps --forest -A -o pid,user,cmd'
zstyle ':completion:*:processes-names' command 'ps axho command'
zstyle ':completion:*:default' list-colors ${(s.:.)LS_COLORS}
unalias ld ls ll &>/dev/null
if testbin mise; then
eval "$(mise activate zsh)"
fi