-
Notifications
You must be signed in to change notification settings - Fork 1
/
tcshrc
193 lines (157 loc) · 4.37 KB
/
tcshrc
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
#!/bin/tcsh
# .tcshrc
# A righteous umask
umask 22
# KDE sets IFS to a spurious value
unsetenv IFS
# basic stuff
set path = ($HOME/bin /sbin /bin /usr/sbin /usr/bin /usr/games /usr/local/sbin /usr/local/bin)
#give lynx a custom configuration
alias lynx 'lynx -nopause -cfg=~/.lynxcfg'
# Remove Emacs Backups
alias reb 'find . -name "*~" -print -exec rm -f {} \;'
# make a directory and change to it
alias mkcd 'mkdir -p \!:1; cd \!:1'
switch (`uname -s`)
case "NetBSD":
alias la 'ls -la'
alias ll 'ls -l'
alias lc 'ls -CF'
setenv DIFF_OPTIONS -urN
set path = ($HOME/bin /sbin /bin /usr/sbin /usr/bin /usr/pkg/sbin /usr/pkg/bin /usr/X11R6/bin)
breaksw
case "FreeBSD":
alias la 'ls -laG'
alias ll 'ls -lG'
alias lc 'ls -CFG'
alias lycd 'lynx /host/localhost/cd/'
alias lycf 'lynx /host/localhost/cf/'
setenv DIFF_OPTIONS -urN
setenv GREP_OPTIONS --colour=auto
breaksw
case "Linux":
alias la 'ls -la --color=auto'
alias ll 'ls -l --color=auto'
alias lc 'ls -CF --color=auto'
alias diff 'diff -urN'
setenv GREP_OPTIONS --colour=auto
breaksw
case "SunOS":
alias la 'ls -la'
alias ll 'ls -l'
alias lc 'ls -CF'
alias diff 'diff -ur'
breaksw
default:
echo Unrecognised system: \"`uname -s`\"
endsw
# some other users (the cd . uses the special alias to reset xterm title)
setenv am_root "NO"
which whoami >/dev/null
if ($? == 0) then
if (`whoami` == root) then
setenv am_root "YES"
endif
endif
if ("${am_root}" == "NO") then
switch (`uname -s`)
case "NetBSD":
case "FreeBSD":
# alias toor 'su -l toor; cd .'
alias toor 'exec su -l toor'
alias root 'exec su -l root'
breaksw
case "Linux":
alias toor 'exec su - toor'
alias root 'exec su - root'
breaksw
case "SunOS":
alias toor 'exec su - toor'
alias root 'exec su - root -c /bin/bash'
breaksw
endsw
endif
unsetenv am_root
alias su 'su \!* ; cd .'
alias edit "eie --no-frame"
alias ed "eie --no-wait"
setenv EDITOR "eie"
foreach value (less more zile ex)
setenv PAGER `which $value`
if (-x "$PAGER") then
if ($value != less) then
alias less "$PAGER"
endif
break
endif
end
setenv BLOCKSIZE M
setenv LESS '-i -R'
setenv LYNX CFG=~/.lynxcfg
# command line completion
set fignore = (.o \~)
# sort out if interactive
if ($?prompt) then
# An interactive shell -- set some stuff up
set filec
set history = 1000
set savehist = 1000
set mail = (/var/mail/$USER)
set autolist
#Keys 2=Insert 3=Delete 5=Page Up 6=Page Down 7=Home 8=End
# normal=~ control=^
# bindkey "^[[2~" delete-char
bindkey "^[[3~" delete-char
bindkey "^[[5~" i-search-back
bindkey "^[[6~" i-search-fwd
bindkey "^[[7~" beginning-of-line
bindkey "^[[8~" end-of-line
bindkey "^R" i-search-back
if (${TERM} == "cons25") then
bindkey "^?" delete-char
endif
set prompt = '%S%m%s:%B%c2%b%% '
which whoami >/dev/null
if ($? == 0) then
if (`whoami` == root) then
set prompt = '%S%m%s:%B%c2%b[%UROOT%u]# '
endif
endif
if (-f /etc/termcap && ${TERM} == "xterm-color" ) then
if (`grep 'xterm-color[:|]' /etc/termcap` == "") then
setenv TERMCAP \
"xterm-color:pa#64:Co#8:AF=\E[3%dm:AB=\E[4%dm:op=\E[39;49m:tc=vt220:"
endif
endif
if (${TERM} != "cons25" && ${TERM} != "linux") then
# auto executes when cd is used
alias cwdcmd 'echo -n "]2;tcsh: ${USER}@${HOST}: $cwd]1;${HOST}"'
cwdcmd
endif
# dd
complete dd c/--/"(help version)"/ c/\[io\]f=/f/ \
c/conv=\*,/"(ascii ebcdic ibm block unblock lcase notrunc ucase swab noerror sync)"/,\
c/conv=/"(ascii ebcdic ibm block unblock \
lcase notrunc ucase swab noerror sync)"/,\
c/\*=/x:'<number>'/ \
n/\*/"(if of conv ibs obs bs cbs files skip file seek count)"/=
# git
if (-d "/usr/local/libexec/git-core") then
set gitcmds = ( `ls -1 /usr/local/libexec/git-core/git-* | sed 's@^/usr/local/.*/git-@@g'` )
complete git "p/1/(${gitcmds})/" \
'n/branch/`git branch|cut -c 3-`/' 'n/co/`git branch|cut -c 3-`/' \
'n/remote/(show add rm prune update)/' 'N/remote/`git remote`/'
unset gitcmds
endif
# for fun
test -x /usr/games/pom && /usr/games/pom
endif
# additional customisation
set auto_start = "${HOME}/bin/AutoStart.*"
ls $auto_start >& /dev/null
if ($status == 0) then
foreach script ($auto_start)
source "${script}"
end
endif
unset auto_start