1
0
Fork 0

zshrc cleanup

This commit is contained in:
Von Random 2018-07-06 03:12:05 +03:00
parent 6b4fe587cd
commit 5cd9a448a2

41
zshrc
View file

@ -179,24 +179,8 @@ alias scr='command screen sudo -Es'
alias vi='vim' alias vi='vim'
# }}} # }}}
# {{{ plugins # {{{ plugins
# colors
font_colors() {
color_number=0
# colors are named for the solarized palette
for color in \
gray6 red green yellow blue magenta cyan gray1 \
black orange gray5 gray4 gray3 purple gray2 white
do
eval "${color}='\e[38;5;${color_number}m'"
(( color_number++ ))
done
unset color_number
reset='\e[0m'
bold='\e[1m'
}
# grc # grc
colorize() { if [[ -x "$(whence grc)" ]]; then
local cmds cmd
cmds=(\ cmds=(\
cc configure cvs df dig gcc gmake id ip last lsof make mount \ cc configure cvs df dig gcc gmake id ip last lsof make mount \
mtr netstat ping ping6 ps tcpdump traceroute traceroute6 \ mtr netstat ping ping6 ps tcpdump traceroute traceroute6 \
@ -204,22 +188,14 @@ colorize() {
for cmd in $cmds[@]; do for cmd in $cmds[@]; do
alias $cmd="command grc -es --colour=auto $cmd" alias $cmd="command grc -es --colour=auto $cmd"
done done
} unset cmds cmd
if [[ -x "$(whence grc)" ]]; then
colorize
unset -f colorize
fi fi
# because fuck you thats' why
fuck() { echo 'no, fuck you'; }
# some cool git stuff # some cool git stuff
gdiff() { /usr/bin/git diff --color "$@"; } gdiff() { /usr/bin/git diff --color "$@"; }
gdf() { gdf() {
local fancydiff='/usr/bin/diff-so-fancy' local difftool
local githighlight='/usr/share/git/diff-highlight/diff-highlight' if difftool=$(whence sdiff-so-fancy); then
if [[ -x $fancydiff ]]; then gdiff "$@" | $difftool | less --tabs=4 -RSFX
gdiff "$@" | $fancydiff | less --tabs=4 -RSFX
elif [[ -x $githighlight ]]; then
gdiff "$@" | $githighlight | less --tabs=4 -RSFX
else else
gdiff "$@" gdiff "$@"
fi fi
@ -233,13 +209,12 @@ greset() {
} }
# ssh-compat, when terminfo is missing # ssh-compat, when terminfo is missing
s() { s() {
local -A terms tempterm ssh local ssh=$(whence ssh)
ssh=$(whence ssh) local terms=(
terms=(
'rxvt-unicode-256color' 'rxvt-unicode' 'rxvt-unicode-256color' 'rxvt-unicode'
'st-256color' 'xterm-256color' 'st-256color' 'xterm-256color'
'tmux-256color' 'screen-256color' 'tmux-256color' 'screen-256color'
) )
TERM=${terms[$TERM]-$TERM} $ssh "$@" TERM=${terms[$TERM]:-$TERM} $ssh "$@"
} }
# }}} # }}}