-
Notifications
You must be signed in to change notification settings - Fork 1
/
bashrc.NetBSD
144 lines (136 loc) · 4.11 KB
/
bashrc.NetBSD
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
# bashrc.Linux
#--------------------------------------------------------------------------------
# Copyright 2016 Joseph Skora
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#--------------------------------------------------------------------------------
eval "`gdircolors`"
alias ls='gls -F --color=auto'
alias ll='ls -l'
alias l="ls -lA"
alias ld="ls -lA"
alias rm='rm -i'
alias cp='cp -i'
alias mv='mv -i'
alias grep="grep --color=auto"
# grep the rainbow
#--------------------------------------------------------------------------------
# sl/cx = selected / context line
# mt/ms/mc = matching text in matching / selected / context line
# fn/ln/bn = filename / linenumber / byte offset
# 01/04/05/07 = bold / underline / blink / inverse
# 30-37,39 = forerground colors black, red, green, yellow, blue, lightred, lightblue, white, default
# 40-47,49 = backrground colors
#--------------------------------------------------------------------------------
asciicolorchart() {
echo "normal"
echo -n " fg "
for XG in $(seq 30 1 37); do
echo -en "\033[01;${XG}m${XG}\033[0m "
done
echo
for BG in $(seq 40 1 47); do
echo -en "bg \033[01;$((${BG}-10))m${BG}\033[0m "
for FG in $(seq 30 1 37); do
echo -en "\033[${FG};${BG}mTest\033[0m "
done
echo
done
echo "bold"
echo -n " fg "
for XG in $(seq 30 1 37); do
echo -en "\033[01;${XG}m${XG}\033[0m "
done
echo
for BG in $(seq 40 1 47); do
echo -en "bg \033[01;$((${BG}-10))m${BG}\033[0m "
for FG in $(seq 30 1 37); do
echo -en "\033[01;${FG};${BG}mTest\033[0m "
done
echo
done
echo "underline"
echo -n " fg "
for XG in $(seq 30 1 37); do
echo -en "\033[01;${XG}m${XG}\033[0m "
done
echo
for BG in $(seq 40 1 47); do
echo -en "bg \033[01;$((${BG}-10))m${BG}\033[0m "
for FG in $(seq 30 1 37); do
echo -en "\033[04;${FG};${BG}mTest\033[0m "
done
echo
done
echo "inverse"
echo -n " fg "
for XG in $(seq 30 1 37); do
echo -en "\033[01;${XG}m${XG}\033[0m "
done
echo
for BG in $(seq 40 1 47); do
echo -en "bg \033[01;$((${BG}-10))m${BG}\033[0m "
for FG in $(seq 30 1 37); do
echo -en "\033[07;${FG};${BG}mTest\033[0m "
done
echo
done
}
#--------------------------------------------------------------------------------
alias grep1="GREP_COLORS='ms=01;31' grep"
alias grep2="GREP_COLORS='ms=01;32' grep"
alias grep3="GREP_COLORS='ms=01;33' grep"
alias grep4="GREP_COLORS='ms=01;34' grep"
alias grep5="GREP_COLORS='ms=01;35' grep"
alias grep6="GREP_COLORS='ms=01;36' grep"
alias grep7="GREP_COLORS='ms=01;37' grep"
alias grep1r="GREP_COLORS='ms=01;30;41' grep"
alias grep2r="GREP_COLORS='ms=01;30;42' grep"
alias grep3r="GREP_COLORS='ms=01;30;43' grep"
alias grep4r="GREP_COLORS='ms=01;33;44' grep"
alias grep5r="GREP_COLORS='ms=01;33;45' grep"
alias grep6r="GREP_COLORS='ms=01;30;46' grep"
alias grep7r="GREP_COLORS='ms=01;30;47' grep"
cdset() {
if [ -f /bin/readlink ]; then
TDIR="$(/bin/readlink ${*:-.})"
else
TDIR="$(/usr/bin/readlink ${*:-.})"
fi
if [ "$TDIR" = "" ]; then
pwd >~/.last_cwd
else
echo $TDIR >~/.last_cwd
fi
}
cdgo() {
TDIR=$(cat ~/.last_cwd 2>/dev/null)
if [ "$TDIR" = "" ]; then
echo "no directory setting in ~/.last_cwd"
else
cd $TDIR
fi
}
EDITOR=$(which --skip-alias vim 2>/dev/null)
if [ $? -ne 0 ]; then
EDITOR=$(which vim 2>/dev/null)
fi
if [ "$EDITOR" = "" ]; then
EDITOR=$(which --skip-alias vi 2>/dev/null)
if [ $? -ne 0 ]; then
EDITOR=$(which vi 2> /dev/null)
fi
fi
if [ "$EDITOR" != "" ]; then
export EDITOR
fi