-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathzsh_aliases
68 lines (57 loc) · 1.77 KB
/
zsh_aliases
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#!/bin/zsh
# tmux color setting as default
[ -x "$(command -v tmux)" ] && alias tmux='tmux -2'
# minicom color settings as default
[ -x "$(command -v minicom)" ] && alias minicom='minicom -c on'
# midnight commander mouse settings as default
[ -x "$(command -v mc)" ] && alias mc='mc -x'
# diff with color
[ -x "$(command -v diff)" ] && alias diff='diff --color=auto'
# color less
export LESS=-R
export LESS_TERMCAP_mb=$'\E[1;31m' # begin blink
export LESS_TERMCAP_md=$'\E[1;36m' # begin bold
export LESS_TERMCAP_me=$'\E[0m' # reset bold/blink
export LESS_TERMCAP_so=$'\E[01;44;33m' # begin reverse video
export LESS_TERMCAP_se=$'\E[0m' # reset reverse video
export LESS_TERMCAP_us=$'\E[1;32m' # begin underline
export LESS_TERMCAP_ue=$'\E[0m' # reset underline
# apply less color for man
man() {
LESS_TERMCAP_md=$'\e[01;31m' \
LESS_TERMCAP_me=$'\e[0m' \
LESS_TERMCAP_se=$'\e[0m' \
LESS_TERMCAP_so=$'\e[01;44;33m' \
LESS_TERMCAP_ue=$'\e[0m' \
LESS_TERMCAP_us=$'\e[01;32m' \
command man "$@"
}
# colormake
if [[ -x "$(command -v colormake)" ]]; then
function enhmake() {
local cmd=colormake
for i; do
if [[ $i =~ "conf" ]]; then
cmd=make
break
fi
done
# run make or colormake with other given args
$cmd "$@"
}
alias make=enhmake
fi
# macOS specific settings
if [[ $OSTYPE == darwin* ]]; then
# match macOS ls color table into general linux color
# requires GNU dircolors (install by `brew install coreutils`)
if [[ -x "$(command -v gdircolors)" ]]; then
# Apply dircolors database
eval "$(gdircolors -b)"
# Alias ls to gls (which can use dircolors database)
alias ls='gls --color=auto'
fi
fi
# Reset exit code to 0 for this script
# (Short-circuit condition check & apply may change exit code)
true