-
Notifications
You must be signed in to change notification settings - Fork 0
/
tcshrc
executable file
·154 lines (140 loc) · 5.25 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
#!/bin/tcsh -X
# .tcshrc
################################################################################
# (T)CSH Interactive start-up script:
#
# This is the script that [t]csh reads when starting an interactive shell. It
# is supposed to be read after .login. Place configuration in this file that
# customizes how you interact with your shell (prompt, completions, etc.).
################################################################################
# For CCS machines:
# This file loads the central .tcshrc that is stored in /ccs/etc/dotfiles. This
# is done because the Systems Group will occasionally update that file to
# reflect changes in the network, and you may be better off if those changes are
# made for you.
################################################################################
# Matt Bisson
#echo '******** RUNNING tcshrc '`date '+%M:%S.%N'`
# If we've not seen the login script, we need to load it. Also, if we have seen
# the thing, but were configured for a different shell, we need to reload it.
if (${?USING_TCSH}) then
if (${USING_TCSH}) then
if (! {$?version}) then
# Was set for tcsh, now using csh
unsetenv SAW_LOGIN_SCRIPT
source "${HOME}/.login"
exit
endif
else
if ({$?version}) then
# Was set for csh, now using tcsh
unsetenv SAW_LOGIN_SCRIPT
source "${HOME}/.login"
exit
endif
endif
else
# We've never seen the LOGIN script
unsetenv SAW_LOGIN_SCRIPT
source "${HOME}/.login"
exit
endif
# This is the only way I know of to determine if I am on a CCS computer Place
# CCS only commands here...
if (-f "/ccs/etc/dotfiles/.tcshrc") then
source "/ccs/etc/dotfiles/.tcshrc"
endif
# Put csh aliases all in one file, in order to collect them in one place. If
# you create more aliases, just add them to that file.
if (-f "${HOME}/.alias.csh") then
source "${HOME}/.alias.csh"
endif
# Add special environment for VMware development if desired
if (${?VMWARE_PROFILE}) then
source "${HOME}/sb/dotfiles/scripts/use_devprofile.csh"
endif
################################################################################
# Terminal-specific customization
################################################################################
# Using stuff set in .login to get the prompt
if (${?BASE_PROMPT}) then
if ((${USING_TCSH}) && (1 == ${?TERM})) then
switch (${TERM})
case "cygwin":
case "dtterm":
case "eterm-color":
case "linux":
case "rxvt":
case "rxvt-unicode":
case "rxvt-*color":
case "sun-color":
case "xterm":
case "xterm-*color":
case "xterm-xfree86":
set prompt="%{^[[01;39m%}${BASE_PROMPT}\#%{^[[00m%} "
breaksw
default
set prompt="${BASE_PROMPT}\# "
breaksw
endsw
else
set prompt="${BASE_PROMPT}# "
endif
endif
# For terminal emulators that advertise their color scheme with $COLORFGBG
# (rxvt, for one), having a value of "default" means it cannot represent the
# background color from 0-15. This will be a problem for (terminal) Emacs and
# friends.
if (! ${?COLORFGBG}) then
if (${TERM} =~ "rxvt") then
set reset_color_fgbg=1
endif
else
if (${COLORFGBG} =~ "default") then
set reset_color_fgbg=1
endif
endif
# Paradoxically, CSH seems to evaluate COLORFGBG located in the ELSE case of a
# "!${?COLORFGBG}" condition that is TRUE, raising an "undefined variable"
# error. The above nonsense (and reset_color_fgbg) solves the issue.
if (${?reset_color_fgbg}) then
stty -icanon -echo min 0 time 1 ; printf '\e]11;?\e\\' ; read tmp_bg
set tmp_bg_avg=`echo $tmp_bg | cat -vet | \
sed 's/.*rgb:\([a-f0-9]*\)\/\([a-f0-9]*\)\/\([a-f0-9]*\).*/0x\1 0x\2 0x\3/' | \
awk '{ print int(((0+$1)+(0+$2)+(0+$3))/3) }'`
if (${status} == 0) then
if ($tmp_bg_avg > 32784) then
setenv COLORFGBG '0;15'
else
setenv COLORFGBG '15;0'
endif
endif
unset tmp_bg
unset tmp_bg_avg
endif
unset reset_color_fgbg
################################################################################
# Miscellaneous settings
################################################################################
if (${USING_TCSH}) then
set autocomplete # TAB does this (not just ^D)
unset autocorrect # Don't fix spelling mistakes?
set autolist = 'ambiguous'
unset autologout
unset correct
unset complete # Case SENSITIVE autocomplete
set listflags = 'a'
set listjobs = 'long'
set listmaxrows = 50
set matchbeep = 'nomatch'
set savehistory = 'merge'
# Use emacs keybindings
bindkey -e
bindkey "^[[1;5D" backward-word # Ctrl + [left]
bindkey "^[[1;5C" forward-word # Ctrl + [right]
bindkey "^[[3~" delete-char # [delete]
endif
unset fignore # Don't ignore anything in completion
set history = 128
unset ignoreeof # I want to log out with ^D
#echo '******** DONE tcshrc '`date '+%M:%S.%N'`