annotate rc/cshrc @ 657:91d7c2e5936c

Remove need to manually switch directory with sud
author nanaya <me@nanaya.pro>
date Sun, 25 Jul 2021 21:36:52 +0900
parents 77c1f9e624a3
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
cd87be0968d9 Initial import.
Edho Prima Arief <me@myconan.net>
parents:
diff changeset
1 #!/usr/bin/env tcsh
241
443e0004a708 [tcsh] Ensures interactive terminal.
Edho Arief <edho@myconan.net>
parents: 127
diff changeset
2
245
f74212d79fcb Ensures we're running tcsh.
Edho Arief <edho@myconan.net>
parents: 244
diff changeset
3 # Ensures it's tcsh
f74212d79fcb Ensures we're running tcsh.
Edho Arief <edho@myconan.net>
parents: 244
diff changeset
4 if ( ! $?tcsh ) then
f74212d79fcb Ensures we're running tcsh.
Edho Arief <edho@myconan.net>
parents: 244
diff changeset
5 exit
f74212d79fcb Ensures we're running tcsh.
Edho Arief <edho@myconan.net>
parents: 244
diff changeset
6 endif
f74212d79fcb Ensures we're running tcsh.
Edho Arief <edho@myconan.net>
parents: 244
diff changeset
7
241
443e0004a708 [tcsh] Ensures interactive terminal.
Edho Arief <edho@myconan.net>
parents: 127
diff changeset
8 # Ensures this script is running on terminal. Otherwise exit immediately.
443e0004a708 [tcsh] Ensures interactive terminal.
Edho Arief <edho@myconan.net>
parents: 127
diff changeset
9 if ( ! $?prompt ) then
443e0004a708 [tcsh] Ensures interactive terminal.
Edho Arief <edho@myconan.net>
parents: 127
diff changeset
10 exit
443e0004a708 [tcsh] Ensures interactive terminal.
Edho Arief <edho@myconan.net>
parents: 127
diff changeset
11 endif
443e0004a708 [tcsh] Ensures interactive terminal.
Edho Arief <edho@myconan.net>
parents: 127
diff changeset
12
243
3167e31f8f01 [tcsh] Sanity tester.
Edho Arief <edho@myconan.net>
parents: 241
diff changeset
13 # Ensures we're not loading this script again.
533
77c1f9e624a3 Rename prefix to `.ec.` instead of `.ecos_`.
edogawaconan <me@myconan.net>
parents: 501
diff changeset
14 if ( ! $?ec_tcsh_loaded ) then
77c1f9e624a3 Rename prefix to `.ec.` instead of `.ecos_`.
edogawaconan <me@myconan.net>
parents: 501
diff changeset
15 set ec_tcsh_loaded="yes"
243
3167e31f8f01 [tcsh] Sanity tester.
Edho Arief <edho@myconan.net>
parents: 241
diff changeset
16 else
3167e31f8f01 [tcsh] Sanity tester.
Edho Arief <edho@myconan.net>
parents: 241
diff changeset
17 exit
3167e31f8f01 [tcsh] Sanity tester.
Edho Arief <edho@myconan.net>
parents: 241
diff changeset
18 endif
3167e31f8f01 [tcsh] Sanity tester.
Edho Arief <edho@myconan.net>
parents: 241
diff changeset
19
533
77c1f9e624a3 Rename prefix to `.ec.` instead of `.ecos_`.
edogawaconan <me@myconan.net>
parents: 501
diff changeset
20 test -f "${HOME}/.ec.tcsh.before" && source "${HOME}/.ec.tcsh.before"
0
cd87be0968d9 Initial import.
Edho Prima Arief <me@myconan.net>
parents:
diff changeset
21 umask 22
cd87be0968d9 Initial import.
Edho Prima Arief <me@myconan.net>
parents:
diff changeset
22 limit coredumpsize 0
cd87be0968d9 Initial import.
Edho Prima Arief <me@myconan.net>
parents:
diff changeset
23
cd87be0968d9 Initial import.
Edho Prima Arief <me@myconan.net>
parents:
diff changeset
24 set prompt="[%B%n@%m %~%b]%# "
533
77c1f9e624a3 Rename prefix to `.ec.` instead of `.ecos_`.
edogawaconan <me@myconan.net>
parents: 501
diff changeset
25 set path=({,/usr}/{bin,sbin} "${HOME}"/{,.ec.}bin)
0
cd87be0968d9 Initial import.
Edho Prima Arief <me@myconan.net>
parents:
diff changeset
26 set history=1000
cd87be0968d9 Initial import.
Edho Prima Arief <me@myconan.net>
parents:
diff changeset
27 set savehist=1000
cd87be0968d9 Initial import.
Edho Prima Arief <me@myconan.net>
parents:
diff changeset
28 set nobeep
cd87be0968d9 Initial import.
Edho Prima Arief <me@myconan.net>
parents:
diff changeset
29 set filec
cd87be0968d9 Initial import.
Edho Prima Arief <me@myconan.net>
parents:
diff changeset
30
cd87be0968d9 Initial import.
Edho Prima Arief <me@myconan.net>
parents:
diff changeset
31 setenv EDITOR vi
cd87be0968d9 Initial import.
Edho Prima Arief <me@myconan.net>
parents:
diff changeset
32 setenv PAGER less
395
c01d272af466 Moved less configuration declaration to environment variable.
Edho Arief <edho@myconan.net>
parents: 341
diff changeset
33 setenv LESS '-MRXgij15$nsz-2'
0
cd87be0968d9 Initial import.
Edho Prima Arief <me@myconan.net>
parents:
diff changeset
34 setenv BLOCKSIZE K
cd87be0968d9 Initial import.
Edho Prima Arief <me@myconan.net>
parents:
diff changeset
35 setenv LC_COLLATE C
cd87be0968d9 Initial import.
Edho Prima Arief <me@myconan.net>
parents:
diff changeset
36 setenv LANG en_US.UTF-8
341
675590e84904 [rc/cshrc] Better LSCOLORS, prompt.
Edho Arief <edho@myconan.net>
parents: 332
diff changeset
37 setenv LSCOLORS "gxfxcxdxbxegedabagacad"
0
cd87be0968d9 Initial import.
Edho Prima Arief <me@myconan.net>
parents:
diff changeset
38
cd87be0968d9 Initial import.
Edho Prima Arief <me@myconan.net>
parents:
diff changeset
39 unset autologout
cd87be0968d9 Initial import.
Edho Prima Arief <me@myconan.net>
parents:
diff changeset
40 unset autoexpand
cd87be0968d9 Initial import.
Edho Prima Arief <me@myconan.net>
parents:
diff changeset
41 unset autolist
cd87be0968d9 Initial import.
Edho Prima Arief <me@myconan.net>
parents:
diff changeset
42 unset ignoreeof
cd87be0968d9 Initial import.
Edho Prima Arief <me@myconan.net>
parents:
diff changeset
43
cd87be0968d9 Initial import.
Edho Prima Arief <me@myconan.net>
parents:
diff changeset
44 unalias \*
78
06fd72a78cc1 tcsh: remote desktop alias.
Edho Prima Arief <me@myconan.net>
parents: 74
diff changeset
45 alias rd "rdesktop -g 1280x700 -K -a 16 -z -P -r sound:off -r clipboard:CLIPBOARD -5"
0
cd87be0968d9 Initial import.
Edho Prima Arief <me@myconan.net>
parents:
diff changeset
46 alias h history 25
cd87be0968d9 Initial import.
Edho Prima Arief <me@myconan.net>
parents:
diff changeset
47 alias j jobs -l
cd87be0968d9 Initial import.
Edho Prima Arief <me@myconan.net>
parents:
diff changeset
48 alias la ls -A
cd87be0968d9 Initial import.
Edho Prima Arief <me@myconan.net>
parents:
diff changeset
49 alias ll ls -lA
cd87be0968d9 Initial import.
Edho Prima Arief <me@myconan.net>
parents:
diff changeset
50 alias ls ls -F
39
3a9d39d8805b [tcsh] Safe rm
Edho Prima Arief <me@myconan.net>
parents: 33
diff changeset
51 alias rm rm -i
501
072662ced8b8 Per-version tmux config.
edogawaconan <me@myconan.net>
parents: 395
diff changeset
52 alias tmux tmux -f ~/.tmux-1.3.conf
0
cd87be0968d9 Initial import.
Edho Prima Arief <me@myconan.net>
parents:
diff changeset
53
cd87be0968d9 Initial import.
Edho Prima Arief <me@myconan.net>
parents:
diff changeset
54 if ($?prompt) then
cd87be0968d9 Initial import.
Edho Prima Arief <me@myconan.net>
parents:
diff changeset
55 set gnuls_opts="--color=auto --group-directories-first -F"
cd87be0968d9 Initial import.
Edho Prima Arief <me@myconan.net>
parents:
diff changeset
56 set iscolor=0
cd87be0968d9 Initial import.
Edho Prima Arief <me@myconan.net>
parents:
diff changeset
57 switch (${TERM})
cd87be0968d9 Initial import.
Edho Prima Arief <me@myconan.net>
parents:
diff changeset
58 case xterm*:
cd87be0968d9 Initial import.
Edho Prima Arief <me@myconan.net>
parents:
diff changeset
59 case dtterm:
cd87be0968d9 Initial import.
Edho Prima Arief <me@myconan.net>
parents:
diff changeset
60 case screen*:
cd87be0968d9 Initial import.
Edho Prima Arief <me@myconan.net>
parents:
diff changeset
61 setenv CLICOLOR
cd87be0968d9 Initial import.
Edho Prima Arief <me@myconan.net>
parents:
diff changeset
62 set myhost=`hostname | cut -d '.' -f 1`
341
675590e84904 [rc/cshrc] Better LSCOLORS, prompt.
Edho Arief <edho@myconan.net>
parents: 332
diff changeset
63 set prompt="[%{\033[0;33m%}%n%{\033[0m%}@%{\033[0;32m%}%m%{\033[0m%} %{\033[0;36m%}%c%{\033[0m%}]%# "
0
cd87be0968d9 Initial import.
Edho Prima Arief <me@myconan.net>
parents:
diff changeset
64 alias mypwd 'printf "%s\n" "${PWD}" | sed -e "s#^${HOME}#~#"'
cd87be0968d9 Initial import.
Edho Prima Arief <me@myconan.net>
parents:
diff changeset
65 alias precmd 'printf "\033]0;${USER}@${myhost}: %s\007" "`mypwd`"'
cd87be0968d9 Initial import.
Edho Prima Arief <me@myconan.net>
parents:
diff changeset
66 set iscolor=1
cd87be0968d9 Initial import.
Edho Prima Arief <me@myconan.net>
parents:
diff changeset
67 breaksw
cd87be0968d9 Initial import.
Edho Prima Arief <me@myconan.net>
parents:
diff changeset
68 endsw
cd87be0968d9 Initial import.
Edho Prima Arief <me@myconan.net>
parents:
diff changeset
69
cd87be0968d9 Initial import.
Edho Prima Arief <me@myconan.net>
parents:
diff changeset
70 if ("$TERM" == "screen") then
cd87be0968d9 Initial import.
Edho Prima Arief <me@myconan.net>
parents:
diff changeset
71 bindkey '\e[1~' beginning-of-line
cd87be0968d9 Initial import.
Edho Prima Arief <me@myconan.net>
parents:
diff changeset
72 bindkey '\e[3~' delete-char
cd87be0968d9 Initial import.
Edho Prima Arief <me@myconan.net>
parents:
diff changeset
73 bindkey '\e[4~' end-of-line
cd87be0968d9 Initial import.
Edho Prima Arief <me@myconan.net>
parents:
diff changeset
74 bindkey '\e[5~' history-search-backward
cd87be0968d9 Initial import.
Edho Prima Arief <me@myconan.net>
parents:
diff changeset
75 bindkey '\e[6~' history-search-forward
cd87be0968d9 Initial import.
Edho Prima Arief <me@myconan.net>
parents:
diff changeset
76 bindkey '\eOD' backward-word
cd87be0968d9 Initial import.
Edho Prima Arief <me@myconan.net>
parents:
diff changeset
77 bindkey '\eOC' forward-word
cd87be0968d9 Initial import.
Edho Prima Arief <me@myconan.net>
parents:
diff changeset
78 bindkey '\e\e[D' backward-word
cd87be0968d9 Initial import.
Edho Prima Arief <me@myconan.net>
parents:
diff changeset
79 bindkey '\e\e[C' forward-word
cd87be0968d9 Initial import.
Edho Prima Arief <me@myconan.net>
parents:
diff changeset
80 endif
cd87be0968d9 Initial import.
Edho Prima Arief <me@myconan.net>
parents:
diff changeset
81 bindkey "^W" backward-delete-word
cd87be0968d9 Initial import.
Edho Prima Arief <me@myconan.net>
parents:
diff changeset
82 bindkey -k up history-search-backward
cd87be0968d9 Initial import.
Edho Prima Arief <me@myconan.net>
parents:
diff changeset
83 bindkey -k down history-search-forward
cd87be0968d9 Initial import.
Edho Prima Arief <me@myconan.net>
parents:
diff changeset
84 endif
cd87be0968d9 Initial import.
Edho Prima Arief <me@myconan.net>
parents:
diff changeset
85
cd87be0968d9 Initial import.
Edho Prima Arief <me@myconan.net>
parents:
diff changeset
86 switch (`uname -s`)
cd87be0968d9 Initial import.
Edho Prima Arief <me@myconan.net>
parents:
diff changeset
87 case FreeBSD:
cd87be0968d9 Initial import.
Edho Prima Arief <me@myconan.net>
parents:
diff changeset
88 set path=(${path} /usr/local/{bin,sbin})
cd87be0968d9 Initial import.
Edho Prima Arief <me@myconan.net>
parents:
diff changeset
89 alias ls ls -FG
cd87be0968d9 Initial import.
Edho Prima Arief <me@myconan.net>
parents:
diff changeset
90 ( which gnuls ) > /dev/null && alias ls gnuls ${gnuls_opts}
cd87be0968d9 Initial import.
Edho Prima Arief <me@myconan.net>
parents:
diff changeset
91 alias man man -o
39
3a9d39d8805b [tcsh] Safe rm
Edho Prima Arief <me@myconan.net>
parents: 33
diff changeset
92 alias rm rm -I
90
1057412834a5 [tcsh] cooler top for freebsd
Edho Prima Arief <edho@myconan.net>
parents: 80
diff changeset
93 alias top top -P
0
cd87be0968d9 Initial import.
Edho Prima Arief <me@myconan.net>
parents:
diff changeset
94 breaksw
cd87be0968d9 Initial import.
Edho Prima Arief <me@myconan.net>
parents:
diff changeset
95 case NetBSD:
cd87be0968d9 Initial import.
Edho Prima Arief <me@myconan.net>
parents:
diff changeset
96 set path=(${path} /usr/pkg/{bin,sbin})
cd87be0968d9 Initial import.
Edho Prima Arief <me@myconan.net>
parents:
diff changeset
97 breaksw
105
b5bda3ecfbd9 OpenBSD, yo.
Edho Prima Arief <edho@myconan.net>
parents: 90
diff changeset
98 case OpenBSD:
0
cd87be0968d9 Initial import.
Edho Prima Arief <me@myconan.net>
parents:
diff changeset
99 set path=(${path} /usr/local/{bin,sbin})
244
b6b9a47de016 Turns out solaris doesn't have [
Edho Arief <edho@myconan.net>
parents: 243
diff changeset
100 test "${iscolor}" -eq 1 && setenv TERM xterm-256color
105
b5bda3ecfbd9 OpenBSD, yo.
Edho Prima Arief <edho@myconan.net>
parents: 90
diff changeset
101 ( which colorls ) > /dev/null && alias ls colorls -FG
0
cd87be0968d9 Initial import.
Edho Prima Arief <me@myconan.net>
parents:
diff changeset
102 breaksw
cd87be0968d9 Initial import.
Edho Prima Arief <me@myconan.net>
parents:
diff changeset
103 case DragonFly:
cd87be0968d9 Initial import.
Edho Prima Arief <me@myconan.net>
parents:
diff changeset
104 set path=(${path} /usr/pkg/{bin,sbin})
cd87be0968d9 Initial import.
Edho Prima Arief <me@myconan.net>
parents:
diff changeset
105 alias ls ls -FG
cd87be0968d9 Initial import.
Edho Prima Arief <me@myconan.net>
parents:
diff changeset
106 breaksw
cd87be0968d9 Initial import.
Edho Prima Arief <me@myconan.net>
parents:
diff changeset
107 case SunOS:
cd87be0968d9 Initial import.
Edho Prima Arief <me@myconan.net>
parents:
diff changeset
108 set path=(${path} /usr/{gnu,csw,xpg4}/{bin,sbin})
244
b6b9a47de016 Turns out solaris doesn't have [
Edho Arief <edho@myconan.net>
parents: 243
diff changeset
109 test -x /usr/gnu/bin/ls && alias ls /usr/gnu/bin/ls ${gnuls_opts}
0
cd87be0968d9 Initial import.
Edho Prima Arief <me@myconan.net>
parents:
diff changeset
110 breaksw
cd87be0968d9 Initial import.
Edho Prima Arief <me@myconan.net>
parents:
diff changeset
111 case Linux:
cd87be0968d9 Initial import.
Edho Prima Arief <me@myconan.net>
parents:
diff changeset
112 alias ls ls ${gnuls_opts}
cd87be0968d9 Initial import.
Edho Prima Arief <me@myconan.net>
parents:
diff changeset
113 alias grep grep --color=auto
cd87be0968d9 Initial import.
Edho Prima Arief <me@myconan.net>
parents:
diff changeset
114 breaksw
cd87be0968d9 Initial import.
Edho Prima Arief <me@myconan.net>
parents:
diff changeset
115 endsw
cd87be0968d9 Initial import.
Edho Prima Arief <me@myconan.net>
parents:
diff changeset
116 unset gnuls_opts
cd87be0968d9 Initial import.
Edho Prima Arief <me@myconan.net>
parents:
diff changeset
117
33
330587be514c Better vim support.
Edho Prima Arief <me@myconan.net>
parents: 25
diff changeset
118 ( which vim ) > /dev/null && alias vi vim && setenv EDITOR vim
0
cd87be0968d9 Initial import.
Edho Prima Arief <me@myconan.net>
parents:
diff changeset
119
533
77c1f9e624a3 Rename prefix to `.ec.` instead of `.ecos_`.
edogawaconan <me@myconan.net>
parents: 501
diff changeset
120 test -f "${HOME}/.ec.tcsh.after" && source "${HOME}/.ec.tcsh.after"
80
59db9fa5d28b [tcsh] Fortune for fun.
Edho Prima Arief <me@myconan.net>
parents: 78
diff changeset
121
244
b6b9a47de016 Turns out solaris doesn't have [
Edho Arief <edho@myconan.net>
parents: 243
diff changeset
122 test -x "/usr/games/fortune" && "/usr/games/fortune"