-
Notifications
You must be signed in to change notification settings - Fork 0
/
base.sh_aliases
202 lines (164 loc) · 3.93 KB
/
base.sh_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
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
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
#!/bin/sh
#
# Copyright (c) 2000-2023 Matthew Pearson <[email protected]>.
#
# These scripts are free. There is no warranty; your mileage may vary.
# Visit http://creativecommons.org/licenses/by-nc-sa/4.0/ for more details.
#
# $Id$
# alias definitions and other sh cmds that must be run per tty
#
hash -r
. $HOME/.isinstalled
unalias cp 2>/dev/null
unalias ls 2>/dev/null
unalias rm 2>/dev/null
alias cp="cp -i"
alias cpf="cp -f"
alias emacs="emacs -nw"
checkls=`ls --color=auto -ah 2>&1 > /dev/null`
if [ $? -ne 0 ] || [ "$checkls" ]
then
alias ls='ls -Fb'
else
alias ls='ls -Fbh --color=auto'
fi
unset checkls
if [ `uname` = "Darwin" ]
then
long_lsflags="O"
verylong_lsflags="Oe@"
fi
alias lsa="ls -A"
alias lsd="ls -d"
alias ll="ls -lh"$long_lsflags
alias lla="ls -Alh"$long_lsflags
alias lld="ls -Alhd"$long_lsflags
alias lll="ls -Alh"$verylong_lsflags
alias lt='ll -rt | tail'
unset long_lsflags
unset verylong_lsflags
alias rm="rm -i"
alias rmf="rm -f"
alias rmrf="rm -rf"
alias mv="mv -i"
alias rehash='hash -r'
alias hi="history"
alias u="uptime"
alias beep="printf '\007\007'"
alias grepn="grep -Hn"
alias nfilt="grep -v \
'\(SCCS\|Bin\|depend\/\|deleted\|TAGS\|pkg\|\.svn\|RCS\|CVS\)'"
alias ipython='label "iPython" && ipython'
alias aws-mfa='. /Users/matty/bin/exec/aws_mfa.bash'
rgrep()
{
grep -r "$*" * | nfilt
}
[ `isinstalled cstyle` ] && alias cstyle="cstyle -chpvP"
[ `isinstalled dbx` ] && alias rdbx="dbx -s $HOME/.dbxrc"
[ `isinstalled node` ] && alias clonejs="node ~/bin/clone.js"
[ `isinstalled python` ] && alias pysum="python -c 'import sys; print sum([int(i) for sublist in sys.stdin for i in sublist.split()])'"
[ `isinstalled bsub` ] && [ `isinstalled bsub_wrapper` ] && \
alias bsub="bsub_wrapper"
if [ `isinstalled a2ps` ]
then
alias c2ps="a2ps -=code"
alias m2ps="a2ps -=man"
alias s2ps="a2ps -=source"
alias t2ps="a2ps -=text"
fi
if [ -x $HOME/Sites/util/publish ]
then
alias publish="$HOME/Sites/util/publish $HOME/Sites"
fi
if [ `uname -s` = 'Darwin' ]
then
psargs='-axo user,pid,state,pri,%cpu,command'
else
psargs='-eo user,pid,s,pri,pcpu,args'
fi
alias psa="ps $psargs"
alias psaw="ps -ww $psargs"
alias psam="psaw | grep __G_USER__"
alias findp="psam | grep -v grep | grep -i"
alias findpa="psaw | grep -v grep | grep -i"
unset psargs
unalias less 2>/dev/null
lessl=`(type less 2>/dev/null) | awk '{print $NF}'`
if [ -x "$lessl" ]
then
PAGER="$lessl"
LESS='-XaeqP?f%f:stdin. ?m[%i of %m] .?lB%lB?L/%L. .?eEOF:?pB%pB\%..%t'
export LESS PAGER
alias more="less"
fi
unset lessl
if [ "$DISPLAY" ]
then
alias x="xrdb -load \$XENVIRONMENT"
alias tt="ttsession -p -c"
fi
unalias bbedit bbdiff bbfind 2>/dev/null
if [ `isinstalled edit` ]
then
[ `isinstalled bbedit` ] || alias bbedit="edit"
fi
if [ `isinstalled twdiff` ]
then
[ `isinstalled bbdiff` ] || alias bbdiff="twdiff"
fi
if [ `isinstalled twfind` ]
then
[ `isinstalled bbfind` ] || alias bbfind="twfind"
fi
alias mods='svn status | grep "^[A|M]" | grep "\.\(py\|java\)$" | awk "{print \$(NF)}"'
if [ `isinstalled bbedit` ] || [ `isinstalled edit` ]
then
openmods()
{
for f in `mods`
do
bbedit $f
done
}
fi
alias sane='tput rmacs'
alias bye='exit'
cerr()
{
cd $1
cat *.err
}
alias cvs='cvs -q'
alias cvsmods='cvs -q -n update 2>/dev/null | grep "^[AM]"'
set_colors()
{
# BSD colors
LSCOLORS="xxxxAxAxxxAxAxBxBxxdxx"
CLICOLOR=1
export LSCOLORS CLICOLOR
# GNU colors
unset LS_COLORS
dirc=`(type dircolors 2>&1) | awk '{print $NF}'`
[ -x "$dirc" ] || dirc=`(type gdircolors 2>&1) | awk '{print $NF}'`
if [ -x "$dirc" ]
then
eval "`$dirc -b $HOME/.dircolors` 2>/dev/null"
export LS_COLORS
fi
unset dirc
RIPGREP_CONFIG_PATH="${HOME}/.ripgreprc"
export RIPGREP_CONFIG_PATH
}
alias gdiff='git diff --word-diff --no-index --'
set_colors
GREP_COLOR='1;4;32'
GREP_OPTIONS="--color=auto"
export GREP_COLOR GREP_OPTIONS
EDITOR="emacs -nw"
GIT_EDITOR="emacs -nw"
VISUAL="emacs -nw"
export EDITOR GIT_EDITOR VISUAL
unset isinstalled
#EOF __TAGGED__