summaryrefslogtreecommitdiff
path: root/corebinutils/csh/tcsh/dot.tcshrc
blob: a155ed56a932e0d84d0aec381c35ffce16764ecc (plain)
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
#
# ~/.tcshrc - Setup user shell environment
#
# See also tcsh(1), environ(7).
#

unalias *

alias	h	'history \!* 20'
alias	j	'jobs -l'
alias	ll	'ls -lAF'
alias	md	mkdir
alias	rd	rmdir

#
# The following commands are only for interactive shells.
#

if ( $?prompt ) then
  set \
    autocorrect \
    autoexpand \
    autolist=ambiguous \
    correct=cmd \
    ellipsis \
    filec \
    history=1000 \
    killdup=erase \
    listjobs=long \
    listlinks \
    listmax=100 \
    nobeep \
    prompt='%N@%m:%B%c02%b%# ' \
    rmstar \
    savehist=(1000 merge) \

  unset promptchars

  if ( $?tcsh ) then
    bindkey -e

    bindkey " " magic-space
    bindkey ^W backward-delete-word
    bindkey ^Z run-fg-editor
    bindkey ^[^W kill-region

    #
    # Setup $hosts from ~/.hosts, ~/.rhosts, ~/.ssh/known_hosts
    #

    if ( ! $?hosts ) then
      set hosts=()
      foreach f ( ~/.{,r,ssh/known_}hosts )
	if ( -r "$f" ) then
	  set hosts=( \
	    $hosts \
	    `sed \
	      -e 's/#.*//' \
	      -e '/^|/d' \
	      -e '/^[+-]@/d' \
	      -e 's/^[+-]//' \
	      -e 's/[[:space:]].*$//' \
	      -e 's/,/\n/g' \
	      "$f" \
	    | sed \
	      -e 's/:[[:digit:]]*$//' \
	      -e 's/^\[\([^]]*\)\]$/\1/' \
	      -e '/^[.:[:xdigit:][:space:]]*$/d' \
	    ` \
	  )
	endif
      end
      unset f
    endif

    uncomplete *

    #
    # Copy from complete.tcsh
    #
    if ( -r ~/.complete ) source ~/.complete

    uncomplete rcp rsh
  endif

  #
  # Set status to ^G in order to keep using ^T for transpose-char.
  #

  switch ( "$OSTYPE" )
  case bsd44:
  case darwin:
  case FreeBSD:
  case NetBSD:
    stty status ^G
    if ( $?tcsh ) bindkey ^G stuff-char
    breaksw
  endsw

  #
  # We don't want to create a root-owned files in our home.
  #

  if ( $uid == 0 ) then
    unset savehist
    setenv LESSHISTFILE -
    setenv VIMINIT ':set viminfo='
  endif

endif