-
Notifications
You must be signed in to change notification settings - Fork 1
/
dot.gholtbashrc
111 lines (98 loc) · 2.5 KB
/
dot.gholtbashrc
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
#!/bin/bash
shopt -s expand_aliases
umask 0027
pathadd() {
if [ -d "$1" ] && [[ ":$PATH:" != *":$1:"* ]] ; then
PATH="$1:$PATH"
fi
}
unalias ls 2>/dev/null
pathadd /opt/bin
pathadd /opt/go/bin
pathadd /usr/local/go/bin
pathadd ~/bin
pathadd ~/go/bin
export HOST=`hostname | cut -d. -f1`
export HOST=`python -c "print('$HOST'.lower())"`
export HOST_TITLE=`python -c "print('$HOST'.title())"`
export EDITOR=vim
export KNOQI_EDITOR=svim
export GREP_COLORS='sl=49;39:cx=49;39:mt=48;5;228;38;5;124;1;4:fn=49;35:ln=49;32:bn=49;32:se=49;36'
export PS1='\e[1;37;40m \u@$HOST \e[1;37;43m \W \e[0m\n# '
export LESSHISTFILE=-
settitle() {
echo -en "\033]0;$*\007"
}
settitle bash
p() {
for i in {1..20} ; do
echo
done
}
Screen() {
if [ -z "$1" ] ; then
screen -dRS `echo $HOST | sed "s/.*/\u&/"`
else
screen -dRS "$1"
fi
}
sshk() {
killall -q ssh-agent
eval `ssh-agent -s`
ssh-add ~/.ssh/*rsa
}
showcolors() {
showcolorshelper(){
printf "%-4s " '' ${bgs[@]}
echo
for bold in ${bolds[@]}; do
for fg in ${fgs[@]}; do
printf "%s;%s " $bold $fg
for bg in ${bgs[@]}; do
printf "\e[%s;%s;%sm%s\e[0m " $bold $fg $bg "text"
done
echo
done
done
}
bolds=( 0 1 )
fgs=( 3{0..7} )
bgs=( 4{0..8} )
showcolorshelper
bolds=( 0 )
fgs=( 9{0..7} )
bgs=( 10{0..8} )
showcolorshelper
}
gitls() {
git status --porcelain | grep -v '^D.\|^.D' | cut -c4-
}
gitfmt() {
gofmt -w -s `gitls | grep '.go$'`
}
if hash go 2>/dev/null ; then
lsgo() {
find "$@" -maxdepth 1 -not -path '*/Godeps/*' -not -path '*/vendor/*' -not -name "zzz_*" -not -name '*_GEN_*' -not -name '*.pb.go' \( -name '*.go' -or -name '*.got' -or -name '*.proto' \) | sed 's,^\./,,' | sort
}
lsgor() {
find "$@" -not -path '*/Godeps/*' -not -path '*/vendor/*' -not -name "zzz_*" -not -name '*_GEN_*' -not -name '*.pb.go' \( -name '*.go' -or -name '*.got' -or -name '*.proto' \) | sed 's,^\./,,' | sort
}
vigo() {
vim `lsgo "$@"`
}
vigor() {
vim `lsgor "$@"`
}
gogo() {
go vet ./... 2>&1 | sed 's/^vet: //' && golangci-lint run --exclude-use-default=false && go test --timeout=1m -cpu=2,7 ./... && go install ./...
}
gogof() {
go fmt ./... && go vet ./... 2>&1 | sed 's/^vet: //' && golangci-lint run --exclude-use-default=false && go test --timeout=1m -cpu=2,7 ./... && go install ./...
}
grepgo() {
grep "$@" `lsgo`
}
grepgor() {
grep "$@" `lsgor`
}
fi