zsh: reorder function definitions
This commit is contained in:
parent
c6858a6a82
commit
c91c3e6d95
2 changed files with 47 additions and 54 deletions
|
@ -1,5 +1,17 @@
|
||||||
# some distributions love to force some aliases upon user :<
|
termcompat() {
|
||||||
unalias ls ld ll 2>/dev/null
|
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' }
|
beep() { printf $'\007' }
|
||||||
fixterm() { printf $'c' }
|
fixterm() { printf $'c' }
|
||||||
|
@ -8,32 +20,25 @@ diff() { command diff --color $@ }
|
||||||
tailf() { command less +F $@ }
|
tailf() { command less +F $@ }
|
||||||
rgrep() { command grep --exclude-dir=\.git -R $@ }
|
rgrep() { command grep --exclude-dir=\.git -R $@ }
|
||||||
fwcmd() { command firewall-cmd $@ }
|
fwcmd() { command firewall-cmd $@ }
|
||||||
|
s() { termcompat ssh $@ }
|
||||||
|
|
||||||
# ls
|
tmux() { command tmux -2 $@ }
|
||||||
if [[ -x $(whence -p exa) ]]; then
|
atmux() { tmux attach || tmux }
|
||||||
ls() { command exa --group-directories-first $@ }
|
sush() { command sudo -Es }
|
||||||
ll() { ls -alg $@ }
|
|
||||||
ld() { ls -dlg $@ }
|
|
||||||
else
|
|
||||||
ls() { command ls --color=auto --group-directories-first $@ }
|
|
||||||
ll() { ls -alh $@ }
|
|
||||||
ld() { ls -dlh $@ }
|
|
||||||
fi
|
|
||||||
|
|
||||||
# emacs
|
|
||||||
em() { command emacsclient -a '' "$@"}
|
em() { command emacsclient -a '' "$@"}
|
||||||
emg() { em -c "$@" }
|
emg() { em -c "$@" }
|
||||||
emt() { em -t "$@" }
|
emt() { em -t "$@" }
|
||||||
emd() { command emacs --daemon &>/dev/null &! }
|
emd() { command emacs --daemon &>/dev/null &! }
|
||||||
|
|
||||||
# git
|
tig() { termcompat tig $@ }
|
||||||
|
gsi() { tig status }
|
||||||
gci() { command git commit $@ }
|
gci() { command git commit $@ }
|
||||||
gsl() { command git stash list $@ }
|
gsl() { command git stash list $@ }
|
||||||
gss() { command git status -sbu $@ }
|
gss() { command git status -sbu $@ }
|
||||||
gup() { command git pull $@ }
|
gup() { command git pull $@ }
|
||||||
groot() { cd $(command git rev-parse --show-toplevel) || return 1 }
|
groot() { cd $(command git rev-parse --show-toplevel) || return 1 }
|
||||||
ggrep() { command git grep $@ }
|
ggrep() { command git grep $@ }
|
||||||
gsi() { command tig status }
|
|
||||||
gdiff() { command git diff --color $@; }
|
gdiff() { command git diff --color $@; }
|
||||||
greset() {
|
greset() {
|
||||||
echo "OK to reset and clean teh repo?"
|
echo "OK to reset and clean teh repo?"
|
||||||
|
@ -48,28 +53,16 @@ else
|
||||||
gdf() { gdiff $@ }
|
gdf() { gdiff $@ }
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
unalias ls ld ll 2>/dev/null
|
||||||
# tmux
|
if [[ -x $(whence -p exa) ]]; then
|
||||||
tmux() { command tmux -2 $@ }
|
ls() { command exa --group-directories-first $@ }
|
||||||
atmux() { tmux attach || tmux }
|
ll() { ls -alg $@ }
|
||||||
|
ld() { ls -dlg $@ }
|
||||||
# sudo
|
else
|
||||||
sush() { command sudo -Es }
|
ls() { command ls --color=auto --group-directories-first $@ }
|
||||||
|
ll() { ls -alh $@ }
|
||||||
# termcompat
|
ld() { ls -dlh $@ }
|
||||||
termcompat() {
|
fi
|
||||||
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
|
|
||||||
|
|
||||||
# grc
|
# grc
|
||||||
if [[ -x $(whence -p grc) ]]; then
|
if [[ -x $(whence -p grc) ]]; then
|
||||||
|
|
|
@ -25,7 +25,7 @@ typeset -A prompt_colors=(
|
||||||
host '#504945'
|
host '#504945'
|
||||||
cwd '#3c3836'
|
cwd '#3c3836'
|
||||||
ro '#d65d0e'
|
ro '#d65d0e'
|
||||||
git_branch '#b16286'
|
git_branch '#504945'
|
||||||
git_unstaged '#d65d0e'
|
git_unstaged '#d65d0e'
|
||||||
git_staged '#458588'
|
git_staged '#458588'
|
||||||
git_untracked '#cc241d'
|
git_untracked '#cc241d'
|
||||||
|
|
Loading…
Reference in a new issue