### .tcshrc
### Paul A. Price, with help from many various sources.
### Revised for use by Pan-STARRS IPP
### 20 Feb 2009


################################################################################
#                                   Aliases                                    #
################################################################################

if ( -f ~/.alias ) source ~/.alias

################################################################################
#                           Environment variables                              #
################################################################################

### File creation mask
### 022 --> u:rwx   g:r-x   o:r-x
#umask 002

### Program to use to edit text files
setenv EDITOR vi
### Program to use to display text files
setenv PAGER less
### C compiler
setenv CC gcc
### Default printer
#setenv PRINTER duplaser

### DS9 / xpans ( http://hea-www.harvard.edu/RD/xpa/ )
setenv  XPA_METHOD local
alias   shifttab  'xmodmap -e "keysym ISO_Left_Tab = Tab"'
alias   ds9frame  'xpaset -p ds9 frame \!*'
alias   ds9hide 'xpaset -p ds9 frame hide \!*'
alias   ds9show 'xpaset -p ds9 frame show \!*'

### Nebulous server
setenv NEB_SERVER http://alala:80/nebulous

#echo "Environment"

###############################################################################
#                         Pan-STARRS IPP psconfig                             #
###############################################################################

setenv PSCONFIG_MAKEOPTS -j4
if (-e $HOME/psconfig/psconfig.csh) then
    alias psconfig "source $HOME/psconfig/psconfig.csh"
else
    alias psconfig "echo psconfig not available"
endif
psconfig ipp-svn

###############################################################################
#                             Multiple Operating Systems                      #
###############################################################################

set OS = `/bin/sh -c '(/bin/uname||/usr/bin/uname) 2>/dev/null'`
if (`expr $OS = SunOS`) then
        if ( -d /usr/sbin ) then
                set OS = solaris
        endif
endif

if (`expr $OS = solaris`) then
    # Solaris doesn't do colour, for some reason
    alias ls ls -F
    unalias more
    setenv PATH ${PATH}:/usr/ccs/bin/
endif

if (`expr $OS = Darwin`) then
    # Darwin doesn't do colour, for some reason
    alias ls ls -F
    # Fink puts stuff under /sw/bin
    setenv PATH ${PATH}:/sw/bin/
endif

###############################################################################
#                            Interactive sessions                             #
###############################################################################

if ($?prompt) then

	### How to display result from the "time" command
        set time=(10 "\
        Time spent in user mode   (CPU seconds) : %Us\
        Time spent in kernel mode (CPU seconds) : %Ss\
        Total time                              : %Es\
        CPU utilisation (percentage)            : %P")
#        Times the process was swapped           : %W\
#        Times of major page faults              : %F\
#        Times of minor page faults              : %R")
	### Immediately notify of background job changes
	set notify
	### Command history
	set history=1000
	set savehist=1000
	### Don't allow ctrl-d to kill session
	#set ignoreeof
	### Prompt: "price@marauder:/home/price>"
	set promptchars = ">#"
	set prompt = "%n@%m:%/%#"
	### Don't log out automatically
	unset autologout
	### Don't beep on command-line completion, only if nothing found
	#set nobeep
	set matchbeep = "nomatch"
	### Only list files the second time TAB is pushed.
	set autolist="ambiguous"
	### Different characters for different types of symbolic links
	set listlinks
	### Quick filename completion
	#set complete="enhance"
	### No spell-checking of command line.
	unset correct
	### Check mail every 3 minutes
	#set mail=(180 /var/mail/${USER})
	### Ignore files ending in .o and tilde for filename completion.
	set fignore = (.o \~)
	### Colour directories
	set color
	### Be careful about deleting everything
	set rmstar
	### Stating a directory name is the same as changing to it (but let me know)
	set implicitcd = "verbose"
	### Don't allow output redirection to destroy files
	set noclobber
	### Use the history of commands to aid expansion.
	set autoexpand
	### After a 'Ctrl-Z', it lists all the jobs.
	set listjobs=long
	### Limit on core dump size
	limit coredumpsize 0k

	### Change the window title of X terminals
        if (`expr $OS != solaris` && `expr $OS != Darwin`) then
 	    if ( $?TERM ) then
		switch ( $TERM )
		    case xterm*:
		    case rxvt:
		    case eterm:
			alias cwdcmd 'echo -n "\033]0;${USER}@${HOST}: $cwd\007"'
			breaksw
		    case screen:
			alias cwdcmd 'echo -n "\033_${USER}@${HOST}: $cwd\033\\"'
			breaksw
		    default:
			alias cwdcmd 'echo "Directory: $cwd"'
			breaksw
		    endsw
		cd .
	    endif
	endif
	### Done with changing window title

endif


#echo "Setups"


###############################################################################
#                             Key bindings                                    #
###############################################################################

if (`expr $OS != solaris`) then
    if ( -f ~/.bindkey ) source ~/.bindkey
endif

#echo "Bindkey"

###############################################################################
#                             Completions                                     #
###############################################################################

if ( -f ~/.complete ) source ~/.complete


#echo "Complete"

