zsh: reorder function definitions
This commit is contained in:
parent
c6858a6a82
commit
c91c3e6d95
2 changed files with 47 additions and 54 deletions
|
@ -1,41 +1,46 @@
|
||||||
# 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' }
|
||||||
|
|
||||||
diff() { command diff --color $@ }
|
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 $@ }
|
||||||
gci() { command git commit $@ }
|
gsi() { tig status }
|
||||||
gsl() { command git stash list $@ }
|
gci() { command git commit $@ }
|
||||||
gss() { command git status -sbu $@ }
|
gsl() { command git stash list $@ }
|
||||||
gup() { command git pull $@ }
|
gss() { command git status -sbu $@ }
|
||||||
groot() { cd $(command git rev-parse --show-toplevel) || return 1 }
|
gup() { command git pull $@ }
|
||||||
ggrep() { command git grep $@ }
|
groot() { cd $(command git rev-parse --show-toplevel) || return 1 }
|
||||||
gsi() { command tig status }
|
ggrep() { command git grep $@ }
|
||||||
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?"
|
||||||
read -sq _
|
read -sq _
|
||||||
(( $? )) && return 1
|
(( $? )) && return 1
|
||||||
|
@ -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