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,4 +1,4 @@
# shellcheck shell=bash disable=SC1090
# shellcheck shell=bash disable=SC1090,SC2164
[[ $- != *i* ]] && return
HISTSIZE=1000
@ -14,9 +14,6 @@ export SSH_AUTH_SOCK="$XDG_RUNTIME_DIR/ssh-agent.socket"
PS1='\[\e[0m\][ \u@\h \[\e[34m\]\w\[\e[0m\] ]\n\$ '
beep() { printf "\007"; }
fixterm() { printf "\u001bc"; }
diff() { command diff --color "$@"; }
tailf() { command less +F "$@"; }
rgrep() { command grep --exclude-dir=\.git -R "$@"; }
@ -34,7 +31,7 @@ gci() { command git commit "$@"; }
gsl() { command git stash list "$@"; }
gss() { command git status -sbu "$@"; }
gup() { command git pull "$@"; }
groot() { cd "$(command git rev-parse --show-cdup)" || return 1; }
groot() { cd "$(command git rev-parse --show-cdup)"; }
ggrep() { command git grep "$@"; }
gsi() { command tig status; }
@ -42,9 +39,6 @@ gsi() { command tig status; }
tmux() { command tmux -2 "$@"; }
atmux() { tmux attach; }
# sudo
sush() { command sudo -Es; }
# bash-completion
completion_path='/usr/share/bash-completion/bash_completion'
[[ -r "$completion_path" ]] && source "$completion_path"

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

View file

@ -1,13 +1,10 @@
[[ $- != *i* ]] && return
function testbin { whence $@ > /dev/null }
confdir=$HOME/.config/zsh
conflist=(
env.zsh
functions.zsh
settings.zsh
prompt.zsh
functions.zsh
local.zsh
)