xref: /freebsd/share/examples/csh/dot.cshrc (revision a10cee30c94cf5944826d2a495e9cdf339dfbcc8)
1# Here are some example (t)csh options and configurations that you may find interesting
2#
3# $FreeBSD$
4#
5
6# Sets SSH_AUTH_SOCK to the user's ssh-agent socket path if running
7#
8# This has a couple caveats, the most notable being that if a user
9# has multiple ssh-agent(1) processes running, this will very likely
10# set SSH_AUTH_SOCK to point to the wrong file/domain socket.
11if (${?SSH_AUTH_SOCK} != "1") then
12	setenv SSH_AUTH_SOCK `sockstat -u | awk '/^${USER}.+ ssh-agent/ { print $6 }'
13endif
14
15# Change only root's prompt
16if (`id -g` == 0)
17	set prompt="root@%m# "
18endif
19
20# This maps the "Delete" key to do the right thing
21# Pressing CTRL-v followed by the key of interest will print the shell's
22# mapping for the key
23bindkey "^[[3~" delete-char-or-list-or-eof
24
25# Make the Ins key work
26bindkey "\e[2~" overwrite-mode
27
28# Aliases used for completions
29alias _PKGS_PkGs_PoRtS_ 'awk -F\| \{sub\(\"\/usr\/ports\/\"\,\"\"\,\$2\)\;print\ \$2\} /usr/ports/INDEX-name -r | cut -d . -f 1'
30alias _PKGS_PkGs_PoRtS_ 'awk -F\| \{sub\(\"\/usr\/ports\/\"\,\"\"\,\$2\)\;print\ \$2\} /usr/ports/INDEX-`uname -r | cut -d . -f 1`&& pkg_info -E \*'
31
32# Some common completions
33complete chown          'p/1/u/'
34complete dd		'c/[io]f=/f/ n/*/"(if of ibs obs bs skip seek count)"/='
35complete kill		'c/-/S/' 'c/%/j/' 'n/*/`ps -ax | awk '"'"'{print $1}'"'"'`/'
36complete killall	'c/-/S/' 'c/%/j/' 'n/*/`ps -ax | awk '"'"'{print $5}'"'"'`/'
37complete kldunload	'n@*@`kldstat | awk \{sub\(\/\.ko\/,\"\",\$NF\)\;print\ \$NF\} | grep -v Name` @'
38complete make           'n@*@`make -pn | sed -n -E "/^[#_.\/[:blank:]]+/d; /=/d; s/[[:blank:]]*:.*//gp;"`@'
39complete man            'C/*/c/'
40complete pkg_delete     'c/-/(i v D n p d f G x X r)/' 'n@*@`ls /var/db/pkg`@'
41complete pkg_info       'c/-/(a b v p q Q c d D f g i I j k K r R m L s o G O x X e E l t V P)/' 'n@*@`\ls -1 /var/db/pkg | sed s%/var/db/pkg/%%`@'
42complete portmaster   'c/--/(always-fetch check-depends check-port-dbdir clean-distfiles \
43    clean-packages delete-build-only delete-packages force-config help \
44    index index-first index-only list-origins local-packagedir no-confirm \
45    no-index-fetch no-term-title packages packages-build packages-if-newer \
46    packages-local packages-only show-work update-if-newer version)/' \
47    'c/-/(a b B C d D e f F g G h H i l L m n o p r R s t u v w x)/' \
48    'n@*@`_PKGS_PkGs_PoRtS_`@'
49complete service  	'c/-/(e l r v)/' 'p/1/`service -l`/' 'n/*/(start stop reload restart status rcvar onestart onestop)/'
50complete sysctl 'n/*/`sysctl -Na`/'
51
52# Alternate prompts
53set prompt = '#'
54set prompt = '%B%m%b%# '
55set prompt = '%B%m%b:%c03:%# '
56set prompt = '%{\033]0;%n@%m:%/\007%}%B%m%b:%c03:%# '
57set prompt = "%n@%m %c04%m%# "
58set prompt = "%n@%m:%c04 %# "
59set prompt = "[%n@%m]%c04%# "
60set ellipsis
61
62# Color ls
63alias ll	ls -lAhG
64alias ls	ls -G
65
66# Color on many system utilities
67setenv CLICOLOR 1
68
69# other autolist options
70set		autolist = TAB
71