1233429Seadler# Here are some example (t)csh options and configurations that you may find interesting 2233429Seadler# 3233429Seadler# $FreeBSD: releng/11.0/share/examples/csh/dot.cshrc 298515 2016-04-23 16:19:34Z lme $ 4233429Seadler# 5233429Seadler 6233429Seadler# Sets SSH_AUTH_SOCK to the user's ssh-agent socket path if running 7236999Seadler# 8236999Seadler# This has a couple caveats, the most notable being that if a user 9236999Seadler# has multiple ssh-agent(1) processes running, this will very likely 10236999Seadler# set SSH_AUTH_SOCK to point to the wrong file/domain socket. 11233429Seadlerif (${?SSH_AUTH_SOCK} != "1") then 12284929Sbrueffer setenv SSH_AUTH_SOCK `sockstat -u | awk '/^${USER}.+ ssh-agent/ { print $6 }'` 13233429Seadlerendif 14233429Seadler 15233429Seadler# Change only root's prompt 16284929Sbruefferif (`id -g` == 0) then 17233429Seadler set prompt="root@%m# " 18233429Seadlerendif 19233429Seadler 20233429Seadler# This maps the "Delete" key to do the right thing 21233429Seadler# Pressing CTRL-v followed by the key of interest will print the shell's 22233429Seadler# mapping for the key 23233429Seadlerbindkey "^[[3~" delete-char-or-list-or-eof 24233429Seadler 25233429Seadler# Make the Ins key work 26233429Seadlerbindkey "\e[2~" overwrite-mode 27233429Seadler 28233429Seadler# Some common completions 29241602Seadlercomplete cd 'p/1/d/' 30233429Seadlercomplete chown 'p/1/u/' 31234159Seadlercomplete dd 'c/[io]f=/f/ n/*/"(if of ibs obs bs skip seek count)"/=' 32241602Seadlercomplete find 'n/-fstype/"(nfs 4.2)"/' 'n/-name/f/' \ 33241602Seadler 'n/-type/(c b d f p l s)/' \ 34241602Seadler 'n/-user/u/ n/-group/g/' \ 35241602Seadler 'n/-exec/c/' 'n/-ok/c/' \ 36241602Seadler 'n/-cpio/f/' \ 37241602Seadler 'n/-ncpio/f/' \ 38241602Seadler 'n/-newer/f/' \ 39241602Seadler 'c/-/(fstype name perm prune type user nouser group nogroup size inum atime mtime ctime exec \ 40241602Seadler ok print ls cpio ncpio newer xdev depth daystart follow maxdepth mindepth noleaf version \ 41241602Seadler anewer cnewer amin cmin mmin true false uid gid ilname iname ipath iregex links lname empty path \ 42241602Seadler regex used xtype fprint fprint0 fprintf print0 printf not a and o or)/' \ 43241602Seadler 'n/*/d/' 44241602Seadlercomplete fg 'c/%/j/' 45241602Seadlercomplete gpart 'p/1/(add backup bootcode commit create delete destroy modify recover resize restore set show undo unset)/' \ 46241602Seadler 'n/add/x:-t type [-a alignment] [-b start] [-s size] [-i index] [-l label] -f flags geom/' \ 47241602Seadler 'n/backup/x:geom/' \ 48241602Seadler 'n/bootcode/x:[-b bootcode] [-p partcode -i index] [-f flags] geom/' \ 49241602Seadler 'n/commit/x:geom/' \ 50241602Seadler 'n/create/x:-s scheme [-n entries] [-f flags] provider/' \ 51241602Seadler 'n/delete/x:-i index [-f flags] geom/' \ 52241602Seadler 'n/destroy/x:[-F] [-f flags] geom/' \ 53241602Seadler 'n/modify/x:-i index [-l label] [-t type] [-f flags] geom/' \ 54241602Seadler 'n/recover/x:[-f flags] geom/' \ 55241602Seadler 'n/resize/x:-i index [-a alignment] [-s size] [-f flags] geom/' \ 56241602Seadler 'n/restore/x:[-lF] [-f flags] provider [...]/' \ 57241602Seadler 'n/set/x:-a attrib -i index [-f flags] geom/' \ 58241602Seadler 'n/show/x:[-l | -r] [-p] [geom ...]/' \ 59241602Seadler 'n/undo/x:geom/' \ 60241602Seadler 'n/unset/x:-a attrib -i index [-f flags] geom/' 61241602Seadlercomplete grep 'c/-*A/x:<#_lines_after>/' \ 62241602Seadler 'c/-*B/x:<#_lines_before>/' \ 63241602Seadler 'c/--/(extended-regexp fixed-regexp basic-regexp regexp file ignore-case word-regexp line-regexp \ 64241602Seadler no-messages revert-match version help byte-offset line-number with-filename no-filename quiet silent \ 65241602Seadler text directories recursive files-without-match files-with-matches count before-context after-context \ 66241602Seadler context binary unix-byte-offsets)/' \ 67241602Seadler 'c/-/(A a B b C c d E e F f G H h i L l n q r s U u V v w x)/' \ 68241602Seadler 'p/1/x:<limited_regular_expression>/ N/-*e/f/' \ 69241602Seadler 'n/-*e/x:<limited_regular_expression>/' \ 70241602Seadler 'n/-*f/f/' \ 71241602Seadler 'n/*/f/' 72241602Seadlercomplete ifconfig 'p@1@`ifconfig -l`@' \ 73284929Sbrueffer 'n/*/(range phase link netmask mtu vlandev vlan metric mediaopt down delete broadcast arp debug)/' \ 74241602Seadler 'c/%/j/' \ 75241602Seadler 'n/*/`ps -ax | awk '"'"'{print $1}'"'"'`/' 76234159Seadlercomplete kill 'c/-/S/' 'c/%/j/' 'n/*/`ps -ax | awk '"'"'{print $1}'"'"'`/' 77234159Seadlercomplete killall 'c/-/S/' 'c/%/j/' 'n/*/`ps -ax | awk '"'"'{print $5}'"'"'`/' 78241602Seadlercomplete kldload 'n@*@`ls -1 /boot/modules/ /boot/kernel/ | awk -F/ \$NF\ \~\ \".ko\"\ \{sub\(\/\.ko\/,\"\",\$NF\)\;print\ \$NF\}`@' 79241602Seadlercomplete kldunload 'n@*@`kldstat | awk \{sub\(\/\.ko\/,\"\",\$NF\)\;print\ \$NF\} | grep -v Name`@' 80241602Seadlercomplete make 'p@1@`make -pn | sed -n -E "/^[#_.\/[:blank:]]+/d; /=/d; s/[[:blank:]]*:.*//gp;"`@' \ 81241602Seadler 'n@-V@`make -ndv | & grep Global: | sed -E -e "s/^Global://" -e "s/ .*//" -e "/^[[:lower:]]/d" | sort | uniq`@' 82241602Seadlercomplete man 'C/*/c/' 83241602Seadlercomplete netstat 'n@-I@`ifconfig -l`@' 84233429Seadlercomplete pkg_delete 'c/-/(i v D n p d f G x X r)/' 'n@*@`ls /var/db/pkg`@' 85234135Seadlercomplete 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/%%`@' 86241602Seadlercomplete ping 'p/1/$hosts/' 87241602Seadlercomplete pkill 'c/-/S/' \ 88241602Seadler 'n@*@`ps -axc -o command="" | sort | uniq`@' 89241602Seadlercomplete portmaster 'c/--/(always-fetch check-depends check-port-dbdir clean-distfiles clean-packages delete-build-only \ 90241602Seadler delete-packages force-config help index index-first index-only list-origins local-packagedir \ 91241602Seadler no-confirm no-index-fetch no-term-title packages packages-build packages-if-newer packages-local \ 92241602Seadler packages-only show-work update-if-newer version)/' \ 93241602Seadler '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)/' \ 94241602Seadler 'n@*@`pkg_info -E \*`@' 95241602Seadlercomplete rsync "c,*:/,F:/," \ 96241602Seadler "c,*:,F:$HOME," \ 97241602Seadler 'c/*@/$hosts/:/' 98241602Seadlercomplete scp "c,*:/,F:/," \ 99241602Seadler "c,*:,F:$HOME," \ 100241602Seadler 'c/*@/$hosts/:/' 101298515Slmecomplete service 'c/-/(e l r v)/' 'p/1/`service -l`/' 'n/*/(start stop reload restart status rcvar describe extracommands onestart onestop oneextracommands)/' 102241602Seadlercomplete svn 'C@file:///@`'"${HOME}/etc/tcsh/complete.d/svn"'`@@' \ 103241602Seadler 'n@ls@(file:/// svn+ssh:// svn://)@@' \ 104241602Seadler 'n@help@(add blame cat checkout cleanup commit copy delete export help import info list ls lock log merge mkdir move propdel \ 105241602Seadler propedit propget proplist propset resolved revert status switch unlock update)@' 'p@1@(add blame cat checkout cleanup commit \ 106241602Seadler copy delete export help import info list ls lock log merge mkdir move propdel propedit propget proplist propset resolved \ 107241602Seadler revert status switch unlock update)@' 108241602Seadlercomplete ssh 'p/1/$hosts/' \ 109241602Seadler 'c/-/(l n)/' \ 110241602Seadler 'n/-l/u/ N/-l/c/ n/-/c/ p/2/c/ p/*/f/' 111234159Seadlercomplete sysctl 'n/*/`sysctl -Na`/' 112241602Seadlercomplete tmux 'n/*/(attach detach has kill-server kill-session lsc lscm ls lockc locks new refresh rename showmsgs source start suspendc switchc)/' 113241602Seadlercomplete which 'C/*/c/' 114233429Seadler 115241602Seadlerif ( -f /etc/printcap ) then 116241602Seadler set printers=(`sed -n -e "/^[^ #].*:/s/:.*//p" /etc/printcap`) 117241602Seadler complete lpr 'c/-P/$printers/' 118241602Seadler complete lpq 'c/-P/$printers/' 119241602Seadler complete lprm 'c/-P/$printers/' 120241602Seadlerendif 121241602Seadler 122233429Seadler# Alternate prompts 123233429Seadlerset prompt = '#' 124233429Seadlerset prompt = '%B%m%b%# ' 125233429Seadlerset prompt = '%B%m%b:%c03:%# ' 126233429Seadlerset prompt = '%{\033]0;%n@%m:%/\007%}%B%m%b:%c03:%# ' 127233429Seadlerset prompt = "%n@%m %c04%m%# " 128233429Seadlerset prompt = "%n@%m:%c04 %# " 129233429Seadlerset prompt = "[%n@%m]%c04%# " 130233429Seadlerset ellipsis 131233429Seadler 132233429Seadler# Color ls 133233429Seadleralias ll ls -lAhG 134233429Seadleralias ls ls -G 135233429Seadler 136233437Seadler# Color on many system utilities 137233437Seadlersetenv CLICOLOR 1 138233437Seadler 139233429Seadler# other autolist options 140233429Seadlerset autolist = TAB 141