- Make the default values for tcsh more user friendly

- Add an examples file with many of the not accepted suggestions from the discussion

PR:		conf/160689
Reviewed by:	many
Discussed on:	current
Approved by:	cperciva
This commit is contained in:
Eitan Adler 2012-03-24 18:43:18 +00:00
parent d05ed9dcd1
commit 1233083107
3 changed files with 80 additions and 6 deletions

View File

@ -3,13 +3,14 @@
# .cshrc - csh resource script, read at beginning of execution by each shell
#
# see also csh(1), environ(7).
# more examples available at /usr/share/examples/csh/
#
alias h history 25
alias j jobs -l
alias la ls -a
alias la ls -aF
alias lf ls -FA
alias ll ls -lA
alias ll ls -lAF
# A righteous umask
umask 22
@ -17,19 +18,30 @@ umask 22
set path = (/sbin /bin /usr/sbin /usr/bin /usr/games /usr/local/sbin /usr/local/bin $HOME/bin)
setenv EDITOR vi
setenv PAGER more
setenv PAGER less
setenv BLOCKSIZE K
if ($?prompt) then
# An interactive shell -- set some stuff up
set prompt = "`/bin/hostname -s`# "
set prompt = "%n@%m:%c04%# "
set promptchars = "%#"
set filec
set history = 100
set savehist = 100
set history = 1000
set savehist = 1000
set autolist = ambiguous
# Use history to aid expansion
set autoexpand
set autorehash
set mail = (/var/mail/$USER)
if ( $?tcsh ) then
bindkey "^W" backward-delete-word
bindkey -k up history-search-backward
bindkey -k down history-search-forward
bindkey "\e[1~" beginning-of-line #make Home key work;
bindkey "\e[3~" delete-char #make Delete key work;
bindkey "\e[4~" end-of-line #make End key work;
endif
endif

View File

@ -8,6 +8,7 @@ LDIRS= BSD_daemon \
FreeBSD_version \
IPv6 \
bootforth \
csh \
cvsup \
diskless \
drivers \
@ -49,6 +50,7 @@ XFILES= BSD_daemon/FreeBSD.pfa \
bootforth/menu.4th \
bootforth/menuconf.4th \
bootforth/screen.4th \
csh/dot.cshrc \
cvsup/README \
cvsup/cvs-supfile \
cvsup/doc-supfile \

View File

@ -0,0 +1,60 @@
# Here are some example (t)csh options and configurations that you may find interesting
#
# $FreeBSD$
#
# Sets SSH_AUTH_SOCK to the user's ssh-agent socket path if running
if (${?SSH_AUTH_SOCK} != "1") then
setenv SSH_AUTH_SOCK `sockstat | grep "${USER}" | cut -d ' ' -f 6`
endif
# Change only root's prompt
if (`id -g` == 0)
set prompt="root@%m# "
endif
# This maps the "Delete" key to do the right thing
# Pressing CTRL-v followed by the key of interest will print the shell's
# mapping for the key
bindkey "^[[3~" delete-char-or-list-or-eof
# Make the Ins key work
bindkey "\e[2~" overwrite-mode
# Some common completions
complete chown 'p/1/u/'
complete man 'C/*/c/'
complete service 'n/*/`service -l`/'
complete service 'c/-/(e l r v)/' 'p/1/`service -l`/' 'n/*/(start stop reload restart status rcvar onestart onestop)/'
complete kldunload 'n@*@`kldstat | awk \{sub\(\/\.ko\/,\"\",\$NF\)\;print\ \$NF\} | grep -v Name` @'
complete make 'n@*@`make -pn | sed -n -E "/^[#_.\/[:blank:]]+/d; /=/d; s/[[:blank:]]*:.*//gp;"`@'
complete pkg_delete 'c/-/(i v D n p d f G x X r)/' 'n@*@`ls /var/db/pkg`@'
complete 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 svar/db/pkg/%%`@"
complete kill 'c/-/S/' 'c/%/j/' 'n/*/`ps -ax | awk '"'"'{print $1}'"'"'`/'
complete killall 'c/-/S/' 'c/%/j/' 'n/*/`ps -ax | awk '"'"'{print $5}'"'"'`/'
alias _PKGS_PkGs_PoRtS_ 'awk -F\| \{sub\(\"\/usr\/ports\/\"\,\"\"\,\$2\)\;print\ \$2\} /usr/ports/INDEX-name -r | cut -d . -f 1A
alias _PKGS_PkGs_PoRtS_ 'awk -F\| \{sub\(\"\/usr\/ports\/\"\,\"\"\,\$2\)\;print\ \$2\} /usr/ports/INDEX-`uname -r | cut -d . -f 1`&& pkg_info -E \*'
complete portmaster 'c/--/(always-fetch check-depends check-port-dbdir clean-distfiles \
clean-packages delete-build-only delete-packages force-config help \
index index-first index-only list-origins local-packagedir no-confirm \
no-index-fetch no-term-title packages packages-build packages-if-newer \
packages-local packages-only show-work update-if-newer version)/' \
'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)/' \
'n@*@`_PKGS_PkGs_PoRtS_`@'
# Alternate prompts
set prompt = '#'
set prompt = '%B%m%b%# '
set prompt = '%B%m%b:%c03:%# '
set prompt = '%{\033]0;%n@%m:%/\007%}%B%m%b:%c03:%# '
set prompt = "%n@%m %c04%m%# "
set prompt = "%n@%m:%c04 %# "
set prompt = "[%n@%m]%c04%# "
set ellipsis
# Color ls
alias ll ls -lAhG
alias ls ls -G
# other autolist options
set autolist = TAB