1
0
Fork 0

zsh: reorder function definitions

This commit is contained in:
Von Random 2022-08-23 10:55:20 +03:00
parent c6858a6a82
commit c91c3e6d95
2 changed files with 47 additions and 54 deletions

View file

@ -1,5 +1,17 @@
# some distributions love to force some aliases upon user :<
unalias ls ld ll 2>/dev/null
termcompat() {
typeset term=$TERM
case $term in
(alacritty*) ;&
(kitty*) ;&
(xterm-*)
term=xterm;;
(rxvt-unicode*)
term=rxvt-unicode;;
(tmux*)
term=screen.xterm-new;;
esac
TERM=$term command $@
}
beep() { printf $'\007' }
fixterm() { printf $'c' }
@ -8,32 +20,25 @@ diff() { command diff --color $@ }
tailf() { command less +F $@ }
rgrep() { command grep --exclude-dir=\.git -R $@ }
fwcmd() { command firewall-cmd $@ }
s() { termcompat ssh $@ }
# ls
if [[ -x $(whence -p exa) ]]; then
ls() { command exa --group-directories-first $@ }
ll() { ls -alg $@ }
ld() { ls -dlg $@ }
else
ls() { command ls --color=auto --group-directories-first $@ }
ll() { ls -alh $@ }
ld() { ls -dlh $@ }
fi
tmux() { command tmux -2 $@ }
atmux() { tmux attach || tmux }
sush() { command sudo -Es }
# emacs
em() { command emacsclient -a '' "$@"}
emg() { em -c "$@" }
emt() { em -t "$@" }
emd() { command emacs --daemon &>/dev/null &! }
# git
tig() { termcompat tig $@ }
gsi() { tig status }
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-toplevel) || return 1 }
ggrep() { command git grep $@ }
gsi() { command tig status }
gdiff() { command git diff --color $@; }
greset() {
echo "OK to reset and clean teh repo?"
@ -48,28 +53,16 @@ else
gdf() { gdiff $@ }
fi
# tmux
tmux() { command tmux -2 $@ }
atmux() { tmux attach || tmux }
# sudo
sush() { command sudo -Es }
# termcompat
termcompat() {
typeset term
case $TERM in
(rxvt-unicode-*) term=rxvt-unicode;;
(tmux*) term=screen.xterm-new;;
(*) term=xterm;;
esac
TERM=$term command $@
}
cmds=(ssh tig)
for cmd in $cmds; do
alias $cmd="termcompat $cmd"
done
unalias ls ld ll 2>/dev/null
if [[ -x $(whence -p exa) ]]; then
ls() { command exa --group-directories-first $@ }
ll() { ls -alg $@ }
ld() { ls -dlg $@ }
else
ls() { command ls --color=auto --group-directories-first $@ }
ll() { ls -alh $@ }
ld() { ls -dlh $@ }
fi
# grc
if [[ -x $(whence -p grc) ]]; then

View file

@ -25,7 +25,7 @@ typeset -A prompt_colors=(
host '#504945'
cwd '#3c3836'
ro '#d65d0e'
git_branch '#b16286'
git_branch '#504945'
git_unstaged '#d65d0e'
git_staged '#458588'
git_untracked '#cc241d'