-
Notifications
You must be signed in to change notification settings - Fork 1
/
cshrc
137 lines (122 loc) · 3.22 KB
/
cshrc
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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
# .cshrc
# Get system OS
@ is_linux=0
@ is_netbsd=0
@ is_freebsd=0
set os = `uname -s`
if ($os == "Linux") @ is_linux=1
if ($os == "NetBSD") @ is_netbsd=1
if ($os == "FreeBSD") @ is_freebsd=1
if ($os == "Darwin") @ is_freebsd=1
# Aliases
alias h history 25
alias j jobs -l
if ($is_linux) alias ls ls --color=auto -F
if ($is_netbsd) alias ls /usr/pkg/bin/colorls -G
if ($is_freebsd) alias ls ls -G
alias la ls -a
alias lf ls -FA
alias ll ls -lA
alias su su -m
alias vim nvim
# Environmental Variables
setenv EDITOR vim
setenv VISUAL ${EDITOR}
setenv EXINIT 'set autoindent'
setenv PAGER less
if ($is_netbsd) setenv PKG_PATH "ftp://ftp.netbsd.org/pub/pkgsrc/packages/NetBSD/amd64/5.0.1_2010Q1/All"
# Path
set path = ( /usr/pkg/{,s}bin ~/bin /bin /sbin /usr/{bin,sbin,X11R7/bin,X11R6/bin,pkg/{,s}bin,games} \
/usr/local/{,s}bin)
# tcsh settings
if ($?prompt) then
# An interactive shell -- set some stuff up
set filec
set history = 1000
set mail = (/var/mail/$USER)
set mch = `hostname -s`
set autologout = 60
set autolist
bindkey "^W" backward-delete-word
bindkey -k up history-search-backward
bindkey -k down history-search-forward
bindkey "^[j" history-search-backward
bindkey "^[k" history-search-forward
bindkey "^r" i-search-back
bindkey "^[h" backward-word
bindkey "^[l" forward-word
bindkey "\e[1~" beginning-of-line # Home
bindkey "\e[7~" beginning-of-line # Home rxvt
bindkey "\e[2~" overwrite-mode # Ins
bindkey "\e[3~" delete-char # Delete
bindkey "\e[4~" end-of-line # End
bindkey "\e[8~" end-of-line # End rxvt
# Pretty prompt
set c1 = "%{\033[1;33m%}"
set c2 = "%{\033[1;30m%}"
set c0 = "%{\033[0m%}"
set title = "%{\033]0;%~\007%}"
# Warnings
# Private (ssh-agent) warning
ssh-add -l >& /dev/null
if ($? < 2) then
set warn_priv = " P "
endif
# SSH warning
if ($?SSH_CONNECTION) then
switch ("$SSH_CONNECTION")
case "* 192.168.0.*":
set warn_ssh = " a "
breaksw
case "* 192.168.2.*":
set warn_ssh = " e "
breaksw
case "* 10.27.?.*":
set warn_ssh = " o "
breaksw
endsw
endif
set warn = ""
if ($?warn_priv) then
set warn = "%{\033[42m%}%{\033[30m%}${warn_priv}${c0} ${warn}"
endif
if ($?warn_ssh) then
set warn = "%{\033[41m%}${warn_ssh}${c0} ${warn}"
endif
# Chroot
set chroot = ""
if ($?SCHROOT_SESSION_ID) then
set chroot = "%{\033[44m%} %{\247%} ${c0} "
endif
switch ($TERM)
case "xterm*":
case "screen*":
set prompt = "%{\007%}${title}${chroot}${warn}${c2}%T %m %~${c0} ${c1}%#${c0} "
breaksw
default:
set prompt = "%{\007%}${warn}${chroot}${c2}%T %m %~${c0} ${c1}%#${c0} "
breaksw
endsw
endif
# Paths
cd
setenv PATH ~/.local/bin:/usr/local/bin:$PATH
# Python paths
if (-d ".pyenv") then
setenv PYENV_VIRTUALENV_INIT 1
setenv PYENV_ROOT "${HOME}/.pyenv"
setenv PATH "${PYENV_ROOT}/shims:${PYENV_ROOT}/bin:${PATH}"
pyenv rehash
endif
# Ruby
if (-d ".rbenv") then
setenv RBENV_ROOT ~/.rbenv
setenv PATH "${RBENV_ROOT}/shims:${RBENV_ROOT}/bin:${PATH}"
rbenv rehash
endif
# Node
setenv PATH "./node_modules/.bin:${PATH}"
# Include local
if (-f ".cshrc.local") then
source .cshrc.local
endif