xref: /freebsd/contrib/tcsh/dot.tcshrc (revision a90b9d0159070121c221b966469c3e36d912bf82)
1#
2# ~/.tcshrc - Setup user shell environment
3#
4# See also tcsh(1), environ(7).
5#
6
7unalias *
8
9alias	h	'history \!* 20'
10alias	j	'jobs -l'
11alias	ll	'ls -lAF'
12alias	md	mkdir
13alias	rd	rmdir
14
15#
16# The following commands are only for interactive shells.
17#
18
19if ( $?prompt ) then
20  set \
21    autocorrect \
22    autoexpand \
23    autolist=ambiguous \
24    correct=cmd \
25    ellipsis \
26    filec \
27    history=1000 \
28    killdup=erase \
29    listjobs=long \
30    listlinks \
31    listmax=100 \
32    nobeep \
33    prompt='%N@%m:%B%c02%b%# ' \
34    rmstar \
35    savehist=(1000 merge) \
36
37  unset promptchars
38
39  if ( $?tcsh ) then
40    bindkey -e
41
42    bindkey " " magic-space
43    bindkey ^W backward-delete-word
44    bindkey ^Z run-fg-editor
45    bindkey ^[^W kill-region
46
47    #
48    # Setup $hosts from ~/.hosts, ~/.rhosts, ~/.ssh/known_hosts
49    #
50
51    if ( ! $?hosts ) then
52      set hosts=()
53      foreach f ( ~/.{,r,ssh/known_}hosts )
54	if ( -r "$f" ) then
55	  set hosts=( \
56	    $hosts \
57	    `sed \
58	      -e 's/#.*//' \
59	      -e '/^|/d' \
60	      -e '/^[+-]@/d' \
61	      -e 's/^[+-]//' \
62	      -e 's/[[:space:]].*$//' \
63	      -e 's/,/\n/g' \
64	      "$f" \
65	    | sed \
66	      -e 's/:[[:digit:]]*$//' \
67	      -e 's/^\[\([^]]*\)\]$/\1/' \
68	      -e '/^[.:[:xdigit:][:space:]]*$/d' \
69	    ` \
70	  )
71	endif
72      end
73      unset f
74    endif
75
76    uncomplete *
77
78    #
79    # Copy from complete.tcsh
80    #
81    if ( -r ~/.complete ) source ~/.complete
82
83    uncomplete rcp rsh
84  endif
85
86  #
87  # Set status to ^G in order to keep using ^T for transpose-char.
88  #
89
90  switch ( "$OSTYPE" )
91  case bsd44:
92  case darwin:
93  case FreeBSD:
94  case NetBSD:
95    stty status ^G
96    if ( $?tcsh ) bindkey ^G stuff-char
97    breaksw
98  endsw
99
100  #
101  # We don't want to create a root-owned files in our home.
102  #
103
104  if ( $uid == 0 ) then
105    unset savehist
106    setenv LESSHISTFILE -
107    setenv VIMINIT ':set viminfo='
108  endif
109
110endif
111