Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 170 lines (143 sloc) 4.94 kb
b8676f1 @tpope Initial revision
authored
1 # ~/.cshrc
41b4bd4 @tpope Plain vi doesn't include expandtab
authored
2 # vim:set et sw=2:
b8676f1 @tpope Initial revision
authored
3
4 # Common {{{1
5
7deab87 @tpope Add rbenv
authored
6 foreach dir ( /usr/ucb /usr/local/bin /opt/local/bin /opt/sfw/bin "$HOME/.rbenv/bin" "$HOME/.rbenv/shims" "$HOME/bin" )
41eed66 @tpope Reindent and clean up .cshrc
authored
7 if ( $PATH !~ *$dir* && -d "$dir" ) setenv PATH "${dir}:${PATH}"
b8676f1 @tpope Initial revision
authored
8 end
e30c930 @tpope Add /var/lib/gems/1.9.1/bin to PATH
authored
9 foreach dir ( /usr/bin/X11 /opt/sfw/kde/bin /usr/openwin/bin /usr/dt/bin /usr/games /usr/lib/surfraw /var/lib/gems/1.9.1/bin /var/lib/gems/1.8/bin /usr/local/sbin /usr/sbin /sbin /usr/etc )
41eed66 @tpope Reindent and clean up .cshrc
authored
10 if ( $PATH !~ *$dir* && -d "$dir" ) setenv PATH "${dir}:${PATH}"
b8676f1 @tpope Initial revision
authored
11 end
12
bc8a829 @tpope Ruby, Perl, and misc
authored
13 if ( -f "$HOME/.locale" && ! $?LANG && ! $?LC_ALL ) then
41eed66 @tpope Reindent and clean up .cshrc
authored
14 setenv LANG "`cat ~/.locale`"
bc8a829 @tpope Ruby, Perl, and misc
authored
15 endif
16
b8676f1 @tpope Initial revision
authored
17 setenv ENV "$HOME/.shrc"
dd25591 @tpope Shell stuff
authored
18 setenv CLASSPATH '.'
562cabe @tpope Increased portability of shell rc files
authored
19 if ( -d "$HOME/.java" ) setenv CLASSPATH "${CLASSPATH}:$HOME/.java"
8f21652 @tpope Mostly environment related changes
authored
20 if ( -d "$HOME/java" ) setenv CLASSPATH "${CLASSPATH}:$HOME/java"
5fbd97b @tpope RUBYLIB="$HOME/src/ruby/lib:$HOME/.ruby/lib"
authored
21 setenv RUBYLIB "$HOME/src/ruby/lib:$HOME/.ruby/lib"
a9cafa4 @tpope Restore RUBYOPT
authored
22 setenv RUBYOPT "-rtpope"
dd25591 @tpope Shell stuff
authored
23 setenv PERL5LIB "$HOME/.perl5:$HOME/perl5:$HOME/.perl:$HOME/perl"
8f21652 @tpope Mostly environment related changes
authored
24 setenv RSYNC_RSH 'ssh -axqoBatchMode=yes'
25 if ( { test -t 1 } ) setenv RSYNC_RSH 'ssh -ax'
b8676f1 @tpope Initial revision
authored
26
27 unset dir
28
349d24f @tpope Fix csh ulimits
authored
29 if ( { limit maxproc 512 } ) then >&/dev/null
30 limit maxproc 512 >&/dev/null
31 if ($?CRON == 1) limit maxproc 384 >&/dev/null
bc8a829 @tpope Ruby, Perl, and misc
authored
32 endif
e6daa42 @tpope Removed irrelevant grex stuff
authored
33
b8676f1 @tpope Initial revision
authored
34 if ( $?prompt == 0 ) exit
35 if ( "$prompt" == "" ) exit
36 # }}}1
37 # Environment {{{1
38 umask 022
6a3e8f3 @tpope Guard against missing stty
authored
39 if ( -x /bin/stty ) stty -ixon
b8676f1 @tpope Initial revision
authored
40
1d580ba @tpope Kill hard-coded references to bin/sensible-*
authored
41 if ( -x /usr/local/bin/vim || -x /usr/bin/vim ) then
42 setenv VISUAL vim
43 else if ( -x /usr/bin/vi || -x /bin/vi ) then
44 setenv VISUAL vi
45 endif
b8676f1 @tpope Initial revision
authored
46 setenv BROWSER "$HOME/bin/sensible-browser"
1d580ba @tpope Kill hard-coded references to bin/sensible-*
authored
47 if ( -x /usr/local/bin/less || -x /usr/bin/less || -x /bin/less ) setenv PAGER less
ad8df81 @tpope Misc environment updates in shell rc files
authored
48 setenv LESS 'RFX#10'
41eed66 @tpope Reindent and clean up .cshrc
authored
49 if ( -x /usr/bin/lesspipe ) then
50 setenv LESSOPEN '|lesspipe %s'
51 else
52 setenv LESSOPEN '|"$HOME/.lessfilter" %s'
53 endif
2dac5b2 @tpope Remove old tpope-hostman references
authored
54 if ( ! $?HOST ) set HOST = `tpope-host name`
9078f06 @tpope Changes for cygwin and switch to use of sensible-*
authored
55 setenv LYNX_CFG "$HOME/.lynx.cfg"
8f21652 @tpope Mostly environment related changes
authored
56
57 set noclobber
b8676f1 @tpope Initial revision
authored
58 # }}}
59 # Prompt {{{1
60 if ( `id|sed -e 's/^uid=\([0-9]*\).*$/\1/'` == 0 ) then
41eed66 @tpope Reindent and clean up .cshrc
authored
61 set usercolor = "01;37"
62 set promptchar = "#"
b8676f1 @tpope Initial revision
authored
63 else
41eed66 @tpope Reindent and clean up .cshrc
authored
64 set usercolor = "01;33"
65 set promptchar = "%"
7e175ab @tpope Replace whoami with more portable id -un
authored
66 if ( `id|sed -e 's/^.*gid=[0-9]*(\([^)]*\)).*/\1/'` == `id -un` ) umask 002
b8676f1 @tpope Initial revision
authored
67 endif
68
69 if ( -x /usr/bin/tty || -x /usr/local/bin/tty ) then
ebbb8ef @tpope Improve prompt internals
authored
70 set ttybracket=" [`tty|sed -e s,^/dev/,,`]"
71 set ttyat="`tty|sed -e s,^/dev/,,`@"
b8676f1 @tpope Initial revision
authored
72 else
ebbb8ef @tpope Improve prompt internals
authored
73 set ttyat=""
74 set ttybracket=""
b8676f1 @tpope Initial revision
authored
75 endif
76
77 if ( $?tcsh ) then
2dac5b2 @tpope Remove old tpope-hostman references
authored
78 if ( -x "$HOME/bin/tpope-host" ) then
79 set hostcolor = `tpope-host ansi`
41eed66 @tpope Reindent and clean up .cshrc
authored
80 else
81 set hostcolor = `00;33`
82 endif
ebbb8ef @tpope Improve prompt internals
authored
83
84 set prompt = "%{\e[${usercolor}m%}%n%{\e[00m%}@%{\e[${hostcolor}m%}%m%{\e[00m%}:%{\e[01;34m%}%~%{\e[00m%}%# "
85
41eed66 @tpope Reindent and clean up .cshrc
authored
86 switch ($TERM)
87
88 case screen*:
89 if ( $?STY ) then
a03f7aa @tpope Apparently printf '\e' is nonstandard
authored
90 alias precmd 'printf "\033]1;'"i${ttyat}${HOST}"'\a\033]2;'"${USER}@${HOST}"':%s'"${ttybracket}"'\a\033k'"${ttyat}"'\033\\" "`echo $cwd|sed -e s,^$HOME,~,`"'
b8676f1 @tpope Initial revision
authored
91 else
a03f7aa @tpope Apparently printf '\e' is nonstandard
authored
92 alias precmd 'printf "\033]1;'"i${ttyat}${HOST}"'\a\033]2;'"${USER}@${HOST}"':%s'"${ttybracket}"'\a\033k'"${ttyat}${HOST}"'\033\\" "`echo $cwd|sed -e s,^$HOME,~,`"'
b8676f1 @tpope Initial revision
authored
93 endif
41eed66 @tpope Reindent and clean up .cshrc
authored
94 breaksw
95
96 case xterm*:
97 case rxvt*:
98 case Eterm*:
99 case kterm*:
100 case putty*:
101 case dtterm*:
102 case ansi*:
103 case cygwin*:
a03f7aa @tpope Apparently printf '\e' is nonstandard
authored
104 alias precmd 'printf "\033]1;'"${ttyat}${HOST}"'\a\033]2;'"${USER}@${HOST}"':%s'"${ttybracket}"'\a" "`echo $cwd|sed -e s,^$HOME,~,`"'
41eed66 @tpope Reindent and clean up .cshrc
authored
105 breaksw
106
107 case linux*:
8794b7f @tpope Color and prompt fixes
authored
108 case vt220*:
41eed66 @tpope Reindent and clean up .cshrc
authored
109 breaksw
110
111 default:
ebbb8ef @tpope Improve prompt internals
authored
112 set prompt = "%n@%m:%~%# "
41eed66 @tpope Reindent and clean up .cshrc
authored
113 breaksw
114
115 endsw
b8676f1 @tpope Initial revision
authored
116 else
41eed66 @tpope Reindent and clean up .cshrc
authored
117 alias cd 'cd \!* && setprompt'
118 alias chdir 'chdir \!* && setprompt'
119 alias pushd 'pushd \!* && setprompt'
120 alias popd 'popd \!* && setprompt'
fdf3aa1 @tpope Remove dependence on hostname binary
authored
121 alias setprompt 'set prompt = "'`id -un`@$HOST':`pwd|sed -e "s,^$HOME,~,"`'"$promptchar"' "'
41eed66 @tpope Reindent and clean up .cshrc
authored
122 setprompt
123 set history = 100
124 set filec
565d7fa @tpope Fix misc portability issues
authored
125 if ( $TERM =~ screen* ) then
a03f7aa @tpope Apparently printf '\e' is nonstandard
authored
126 printf "\033k%s\033\\" "$ttyat$HOST"
41eed66 @tpope Reindent and clean up .cshrc
authored
127 endif
b8676f1 @tpope Initial revision
authored
128 endif
129
8794b7f @tpope Color and prompt fixes
authored
130 unset hostcolor usercolor promptchar oldterm ttyat ttybracket
b8676f1 @tpope Initial revision
authored
131 # }}}1
132 # Aliases {{{1
77b3793 @tpope Simplify ls alias config
authored
133 if ( -x /usr/bin/dircolors || -x /usr/local/bin/dircolors ) then
134 eval `dircolors -c $HOME/.dir_colors`
d347938 @tpope Include -h in ls alias
authored
135 alias ls 'ls -hF --color=auto'
b8676f1 @tpope Initial revision
authored
136 else
d347938 @tpope Include -h in ls alias
authored
137 alias ls 'ls -hF'
d71f12c @tpope Sync .dir_colors with upstream
authored
138 setenv CLICOLOR 1
139 setenv LSCOLORS ExGxFxdxCxfxDxxbadacad
b8676f1 @tpope Initial revision
authored
140 endif
141
d17ec35 @tpope I don't understand csh syntax
authored
142 grep --color |& grep un >/dev/null || setenv GREP_OPTIONS '--color=auto --exclude=*~ --exclude=tags'
bc8a829 @tpope Ruby, Perl, and misc
authored
143
edf8dfe @tpope Simplify new mail check
authored
144 if ( ! $?MAIL && -f "/var/mail/$USER" ) setenv MAIL "/var/mail/$USER"
b8676f1 @tpope Initial revision
authored
145
0167d8a @tpope Load sh aliases into csh
authored
146 eval `grep '^ alias' $HOME/.shrc | sed -e 's/=/ /' -e 's/$/;/'`
b8676f1 @tpope Initial revision
authored
147
0a4dab3 @tpope Simplify vi alias
authored
148 if ( $?VISUAL && "$VISUAL" == vim ) alias vi vim
b8676f1 @tpope Initial revision
authored
149
150 foreach cmd ( `tpope aliases` )
41eed66 @tpope Reindent and clean up .cshrc
authored
151 alias $cmd "tpope $cmd"
b8676f1 @tpope Initial revision
authored
152 end
153 # }}}1
715a90f @tpope Add tcsh completion
authored
154 # Completion {{{1
155
156 if ( $?tcsh ) then
157 if ( -f /etc/complete.tcsh ) source /etc/complete.tcsh
158 set hosts=(localhost `tpope host list`)
159 alias _extract_subcommands 'grep "^ [a-z-]*[|)]" \!*|sed -e "s/) .*//"|tr "|" " "'
160 complete tpope 'p@1@`_extract_subcommands "$HOME/bin/tpope"`@' \
161 'n@host@`_extract_subcommands $HOME/bin/tpope-host`@' 'N/host/$hosts/' \
162 'n@config@`_extract_subcommands $HOME/bin/tpope-config`@' 'N/config/$hosts/' \
163 'n/*/f/'
164 foreach cmd ( start stop restart reload force-reload status )
165 complete $cmd 'p@1@`(cd /etc/init.d; echo *)`@'
166 end
167 endif
168
169 # }}}1
Something went wrong with that request. Please try again.