# Matt's new, improved, massive .tcshrc # DO NOT EDIT THIS FILE! # This file should never need changing on a per-system basis. set TCSHRC_VERSION="2.0" # Flippable settings in .tcshrc.conf, local settings in .tcshrc.local, # .tcshrc.$user, .tcshrc.{$HOST|$HOSTNAME}, _and_ # .tcshrc.$user@{$HOST|$HOSTNAME}. If that ain't enough flexibility for # you, you've got Problems(tm). # The following OSen are supported: # FreeBSD, PicoBSD, OpenBSD, NetBSD, BSDi BSD/OS, HP/UX, Solaris, # NeXT Mach, and Linux # We'd still like the following, if anyone has stuff for 'em: # AIX, Tru64/Ultrix/DEC UNIX/name-of-the-week, IRIX, SCO, or # just about anything else # CREDITS # Original conglomeration and ongoing maintenance # by Matthew Fuller # BSD/OS, NetBSD, OpenBSD, HP/UX, Mach, and some flippable settings # contributed by Greg Gollinger # First, setup a reasonable lookin' around environment set path=(/usr/{sbin,bin} /{sbin,bin}) # Figure out what OS we're running set _tcshrc_osvers=`uname -sr` switch("$_tcshrc_osvers") case "FreeBSD*": case "PicoBSD*": set _tcshrc_runos=FREEBSD breaksw case "NetBSD*": case "OpenBSD*": set _tcshrc_runos=NETBSD breaksw case "BSD/OS*": set _tcshrc_runos=BSDI breaksw # Order of these is important! case "SunOS\ [1234]*": set _tcshrc_runos=SUNOS breaksw case "SunOS\ *": set _tcshrc_runos=SOLARIS breaksw case "Linux*": set _tcshrc_runos=LINUX breaksw case "HP-UX\ ??09*": set _tcshrc_runos=HP9 breaksw case "HP-UX\ 1[01]*": set _tcshrc_runos=HP1x breaksw case "HP-UX\ ??1[01]*": set _tcshrc_runos=HP1x breaksw default: # NeXT Mach is notable in lacking uname, the fools if ( -x /LocalApps) then set _tcshrc_runos=NEXT else # We'll use a set of 'defaults' for this set _tcshrc_runos=UNKNOWN endif breaksw endsw # Now, let's see some action! # OS dependant stuff first... # Path settings # This is the basic, 'normal' path we'll basically always have set path=(/usr/local/{bin,sbin} /usr/{bin,sbin} /{bin,sbin}) switch("$_tcshrc_runos") case "FREEBSD": case "NETBSD": case "BSDI": case "LINUX": case "UNKNOWN": # X if ( -x /usr/X11R6/bin ) then set path=($path /usr/X11R6/bin) else if ( -x /usr/X11/bin ) then set path=($path /usr/X11/bin) endif breaksw case "SUNOS": # Bastard mix of BSD and SysV set path=($path /usr/ucb) if ( -x /usr/openwin/bin ) then set path=($path /usr/openwin/bin) endif breaksw case "SOLARIS": # Blah, SysV... set path=($path /usr/{ucb,ccs/bin}) if ( -x /usr/openwin/bin ) then set path=($path /usr/openwin/bin) endif breaksw case "HP9" # Very strange flavor, generally BSDish set path = ($path /usr/ucb /etc /usr/libexec) if ( -x /usr/X11/bin ) then set path = ($path /usr/X11/bin) endif if ( -x /usr/vue/bin ) then set path = ($path /usr/vue/bin) endif breaksw case "HP1x" # HP made an effort to make 10.x and 11.x SysV # 10.x is a digusting perversion of BSD and SysV # 11.x is at least mostly SysV-ish # XXX /opt/* is questionable, may be too big to fit in $path set path = ($path /usr/ucb /opt/* /usr/ccs/bin /usr/libexec) if ( -x /usr/lbin ) then set path = ($path /usr/lbin) endif if ( -x /usr/X11/bin ) then set path = ($path /usr/X11/bin) endif if ( -x /usr/vue/bin) then set path = ($path /usr/vue/bin) endif breaksw case "NEXT": # You laugh, but they're nice boxes, and they're still around set path = ($path /usr{etc,ucb,gnu/bin,lib} /etc /LocalApps \ /NeXTApps) breaksw endsw # And the bits we may always use if( -x ~/bin ) then # Stick this on the front of the list set path=(~/bin $path) endif if( -x /usr/contrib/bin ) then set path=($path /usr/contrib/bin) endif if( -x /usr/share/bin ) then set path=($path /usr/share/bin) endif if( -x /usr/local/scripts ) then set path=($path /usr/local/scripts) endif if( -x /usr/games ) then set path=($path /usr/games) endif # Now the OS dependant aliases, env's, etc switch("$_tcshrc_runos") case "FREEBSD": case "NETBSD": case "BSDI": case "NEXT": case "UNKNOWN": alias p 'ps -agOuser' alias psa 'ps -gaxuww \!* | $PAGER' set _tcshrc_euid=`id -u` breaksw case "SUNOS": alias p 'ps -agu' alias psa 'ps -gaxuww \!* | $PAGER' set _tcshrc_euid=`id -u` breaksw case "SOLARIS": alias p '/usr/ucb/ps -agu' alias psa '/usr/ucb/ps -gaxuww \!* | $PAGER' set _tcshrc_euid=`id | sed "s/[a-z\(\)\=]//g" | awk '{print $1}'` breaksw case "LINUX" # Silly GNU ps alias p 'ps ua' alias psa 'ps axuww \!* | $PAGER' set _tcshrc_euid=`id -u` breaksw case "HP9": # HP/UX 9.x doesn't have a /usr/ucb/ps, fools alias p 'ps -la' alias psa 'ps -ela \!* | $PAGER' set _tcshrc_euid=`id -u` breaksw case "HP1x": alias p '/usr/ucb/ps -agu' alias psa '/usr/ucb/ps -gaxuww \!* | $PAGER' set _tcshrc_euid=`id -u` breaksw endsw # Done OS dependant, let's get the basic normal stuff # First, snarf the conf file if it exists if( -r ~/.tcshrc.conf ) then source ~/.tcshrc.conf else # We're in trouble, but let's fudge it echo "Warning: can't find .tcshrc.conf; using default values" endif # Default values if( ! ${?_tcshrc_bs_send} ) then set _tcshrc_bs_send="BS" endif if( ! ${?_tcshrc_domain_prompt} ) then set _tcshrc_domain_prompt="YES" endif if( ! ${?_tcshrc_user_prompt} ) then set _tcshrc_user_prompt="YES" endif if( ! ${?_tcshrc_date_prompt} ) then set _tcshrc_date_prompt="NO" endif if( ! ${?_tcshrc_root_prompt} ) then set _tcshrc_root_prompt="YES" endif if( ! ${?_tcshrc_allow_messages} ) then set _tcshrc_allow_messages="YES" endif if( ! ${?_tcshrc_file_perms} ) then set _tcshrc_file_perms="STANDARD" endif # Add any $path additions if( ${?_tcshrc_path_add} ) then set path=($path $_tcshrc_path_add) endif # Few shell settings set history=1000 # Frobit set notify set ignoreeof set filec # tcsh doesn't need it, but if you're using csh... unset autologout # Man, I hate this... unset noclobber # Live on the edge #set printexitvalue # These aren't useful in csh, but... set pushdtohome set pushdsilent # Save/restore state if we have a state dir if( ${?_tcshrc_state_dir} ) then # Two-level because tcsh doesn't short-circuit :( if( -d $_tcshrc_state_dir && -w $_tcshrc_state_dir ) then # History set histfile=$_tcshrc_state_dir/history.$HOST.$user.$tty set savehist=($history merge) # This properly collapses dupes; idempotent history -M # Dir stack set dirsfile=$_tcshrc_state_dir/dirs.$HOST.$user.$tty set savedirs=50 # dirs -L is *NOT* idempotent. Don't bother loading this if we # already have >1 entry on the stack. if( ${#dirstack} <= 1 ) then # dirs -L changes our current dir to the dir at the top of # the stack, and doesn't do any sort of merging. Bad monkey! set _curwd=$cwd dirs -L pushd $_curwd unset _curwd endif endif endif # General aliases alias . 'exit' alias ? 'apropos' # If you use csh, you probably want to ">> /dev/null" these to shut up # the printing of the stack to stdout every time. tcsh obeys the # 'pushdsilent' above. alias back 'pushd -' alias cd 'pushd' alias cdrem 'cd $dirrem' alias remdir 'set dirrem=$cwd' alias f 'finger' alias format 'cat \!* | pr -t -e4' alias formatc 'cat \!* | pr -t -e4 -n" "4' alias grp 'grep' alias grpe 'grep' # I don't use mh, but after the first time you sit on the stove... alias inc 'inc -notruncate' # HP/UX has ll and la commands, but we'll still alias them anyway alias ls 'ls -F' alias ll 'ls -al' alias lm 'll \!* | $PAGER' alias manread 'groff -Tascii -man < \!^ | less' alias more 'more -e' alias page '\!* | $PAGER' alias pine 'pine -z' alias pico 'pico -z' alias qb '\!* >& /dev/null &' alias wnm 'w | grep -v \^$user' alias xttitle 'printf "\033]0;\!*\007"' # I HATE when people 'alias mail something' unalias mail # Change what's considered a 'word' for fwd/back-word set wordchars="*?[]~=" # Auto-time long-running processes. And mess with the format of time's # output too. #set time=(60 "%Uu %Ss %E(%P) %X+%Dk(%M) %I/%Oio %Fpf+%Ww") # Check some various alternate programs # -X doesn't exist in csh; you may have to change these if you're using # it. -x doesn't search $path, though. if( -X less ) then setenv PAGER 'less' else setenv PAGER 'more' endif if( -X gnuls ) then alias gls 'gnuls --color=tty' alias gll 'gnuls -la --color=tty' endif # Other Env's setenv EDITOR 'vi' setenv BLOCKSIZE 1024 # Gotta make sure we have some bindings right... # These don't exist in csh either bindkey -b ^I complete-word bindkey -b ^B backward-word bindkey -b ^F forward-word bindkey -b ^W backward-delete-word # Raise the roof unlimit # Random bits # This causes an error message on Solaris if !tty, shut it up # csh doesn't have $tty if( "$tty" != "" ) then # Messages on/off? if ( $_tcshrc_allow_messages == "YES" ) then mesg y else mesg n endif # Make sure that damn backspace key is in shape... if( $_tcshrc_bs_send == "BS" ) then stty erase '' else if( $_tcshrc_bs_send == "DEL" ) then stty erase '' else echo "Unknown BS_SEND setting: $_tcshrc_bs_send" endif endif # Set the umask if( ${?_tcshrc_umask} ) then umask $_tcshrc_umask else switch("$_tcshrc_file_perms") case "OPENWORLD": umask 000 breaksw case "OPENGROUP": umask 002 breaksw case "STANDARD": umask 022 breaksw case "SEMI-CLOSED": umask 027 breaksw case "CLOSED": umask 077 breaksw default: # Dunno what this is... echo "Unknown file_perms setting '$_tcshrc_file_perms', using 022." umask 022 breaksw endsw endif # Now, the prompt... # Test: should we use full domain, or just hostname? if( $_tcshrc_domain_prompt == "YES" ) then set _pr_DP='%M' else set _pr_DP='%m' endif # Username? if( $_tcshrc_user_prompt == "YES" ) then set _pr_UP='%n@' else set _pr_UP='' endif # Date? if( $_tcshrc_date_prompt == "YES" ) then set _pr_DT='%b%Y-%W-%D %B' else set _pr_DT='' endif # OK, so what should the prompt be? # This is all useless in csh too... if( $_tcshrc_root_prompt == "YES" && $_tcshrc_euid == "0" ) then if( ${?_tcshrc_custom_root_prompt} ) then set prompt="$_tcshrc_custom_root_prompt" else #set prompt="{%~} root@${_pr_DP}: %%" set prompt="${_pr_DP}:%/\n%Broot%%%b " endif else if( ${?_tcshrc_custom_prompt} ) then set prompt="$_tcshrc_custom_prompt" else # This yields [time] hostname:cwd \n(tty):{line#}% set prompt="%B[${_pr_DT}%P]%b ${_pr_UP}${_pr_DP}:%~\n(%l):{%h}%% " endif endif # Cleanup unset _pr_* # Local changes/overrides # Grab the .tcshrc.local if it's there if( -r ~/.tcshrc.local ) then source ~/.tcshrc.local endif # Our username if( -r ~/.tcshrc.$user ) then source ~/.tcshrc.$user endif # HOST is set by tcsh, we work from that. # This should work. cut(1) would be nicer, but I tried it once and it # failed on some system (can't remember which), so... set _tcshrc_hostname=`echo $HOST | awk -F\. '{print $1}'` # Then grab .tcshrc.machine.domain, else .tcshrc.machine. if( -r ~/.tcshrc.$HOST ) then source ~/.tcshrc.$HOST else if( -r ~/.tcshrc.$_tcshrc_hostname ) then source ~/.tcshrc.$_tcshrc_hostname endif # By-user variants of above if( -r ~/.tcshrc.$user@$HOST ) then source ~/.tcshrc.$user@$HOST else if( -r ~/.tcshrc.$user@$_tcshrc_hostname ) then source ~/.tcshrc.$user@$_tcshrc_hostname endif # Warn if we don't know what system we're on # csh doesn't have $tty if( "$tty" != "" ) then if( "$_tcshrc_runos" == "UNKNOWN") then echo Warning: OS type not recognized, basic settings used endif endif # Clear cruft out of the environment unset _tcshrc_* # Done