aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAaron LI <aly@aaronly.me>2018-12-01 20:13:18 +0800
committerAaron LI <aly@aaronly.me>2018-12-01 20:13:18 +0800
commitd4a99498acb4d92067704880b12c04d569f7a8c6 (patch)
tree6034af3f081925f8d11d012f25b4395a78f033a5
parentd77463069457d3984fc69ade9004275bba8210f3 (diff)
downloaddotfiles-d4a99498acb4d92067704880b12c04d569f7a8c6.tar.bz2
csh/tcsh: Rewrite config file
-rw-r--r--_cshrc124
-rw-r--r--_tcshrc176
2 files changed, 124 insertions, 176 deletions
diff --git a/_cshrc b/_cshrc
new file mode 100644
index 0000000..bad938b
--- /dev/null
+++ b/_cshrc
@@ -0,0 +1,124 @@
+#
+# ~/.cshrc
+#
+# Aaron LI
+# 2011-06-30
+#
+
+set echo_style=both
+set backslash_quote
+set parseoctal
+unset noclobber
+
+# Skip remaining settings if not an interactive shell
+if ( $?USER == 0 || $?prompt == 0 ) exit
+
+
+# Options
+# -------
+set inputmode=insert
+set autolist
+set autoexpand
+set autocorrect
+set correct=cmd
+set complete=enhance
+set padhour
+set color
+set colorcat
+set nobeep
+set cdtohome
+set autorehash
+set printexitvalue
+
+set histdup
+set histlit
+set nohistclop
+
+unset compat_expr
+unset noglob
+unset autologout
+unset time
+unset tperiod
+
+set prompt = "%S[%m]%s %B%~%b%# "
+
+
+# Systems
+# -------
+if ( `uname -s` == "Linux" ) then
+ set _os = "linux"
+else
+ set _os = "bsd"
+endif
+
+
+# PATH
+# ----
+echo $path | fgrep -q '/sbin'
+if ( $status != 0 ) then
+ set path = ( $path /sbin /usr/sbin /usr/local/sbin )
+endif
+if ( -d ~/.local/bin ) then
+ set path = ( ~/.local/bin $path )
+endif
+if ( -d ~/bin ) then
+ set path = ( ~/bin $path )
+endif
+
+
+# Locale
+# ------
+# NOTE: mosh (https://github.com/mobile-shell/mosh) requires UTF-8.
+# NOTE: login.conf(5) is ignored by SSH since it handles the login by its own
+setenv LANG en_US.UTF-8
+setenv MM_CHARSET UTF-8
+setenv LC_COLLATE C
+
+# Environments
+# ------------
+setenv PAGER less
+setenv EDITOR vi
+
+if ( "${_os}" == "linux" ) then
+ alias ls ls --color=auto
+else
+ setenv CLICOLOR yes
+ setenv LSCOLORS ExGxFxdxCxegedabagExEx
+ alias ls ls -G
+endif
+
+
+# Aliases
+# -------
+alias rm rm -I
+alias h history 25
+alias j jobs -l
+alias la ls -aF
+alias lf ls -FA
+alias ll ls -lAF
+
+
+# Keybindings
+# -----------
+if ( $?tcsh ) then
+ bindkey "^W" backward-delete-word
+ bindkey -k up history-search-backward
+ bindkey -k down history-search-forward
+
+ # Credit:
+ # * https://stackoverflow.com/a/1912527/4856091
+ # * http://www.ibb.net/~anne/keyboard/keyboard.html#Tcsh
+ bindkey "\e[1~" beginning-of-line # Home
+ bindkey "\e[7~" beginning-of-line # Home rxvt
+ bindkey "\e[2~" overwrite-mode # Insert
+ bindkey "\e[3~" delete-char # Delete
+ bindkey "\e[4~" end-of-line # End
+ bindkey "\e[8~" end-of-line # End rxvt
+endif
+
+
+# Local settings
+# --------------
+if ( -e ~/.cshrc.local ) then
+ source ~/.cshrc.local
+endif
diff --git a/_tcshrc b/_tcshrc
deleted file mode 100644
index c4c5abf..0000000
--- a/_tcshrc
+++ /dev/null
@@ -1,176 +0,0 @@
-##
-## ~/.tcshrc
-##
-## Aaron LI
-## 2011-06-30
-##
-## 2017-10-30: Cleanups; add new keybindings
-##
-
-
-### PATH ###
-if ( -d ~/bin ) then
- set path = ( ~/bin $path )
-endif
-
-## admin
-groups | grep -qE '\b(wheel|adm|sudo)\b'
-if ( $status == 0 ) then
- set path = ( $path /sbin /usr/sbin /usr/local/sbin )
-endif
-
-
-### Environments ###
-# colors for 'ls'
-setenv CLICOLOR yes
-setenv LSCOLORS ExGxFxdxCxegedabagExEx
-
-# Misc
-setenv PAGER less
-setenv LESS '-ceiMs'
-setenv EDITOR vim
-setenv VISUAL vim
-
-
-## skip remaining setup if not an interactive shell
-if ( $?USER == 0 || $?prompt == 0 ) exit
-
-
-### color code ###
-# 1 for brighter colors
-# 4 for underlined text
-# 5 for flashing text
-# 30 for black foreground
-# 31 for red foreground
-# 32 for green foreground
-# 33 for yellow (or brown) foreground
-# 34 for blue foreground
-# 35 for purple foreground
-# 36 for cyan foreground
-# 37 for white (or gray) foreground
-# 40 for black background
-# 41 for red background
-# 42 for green background
-# 43 for yellow (or brown) background
-# 44 for blue background
-# 45 for purple background
-# 46 for cyan background
-# 47 for white (or gray) background
-
-#set cr = "%{\e[31m%}" # red
-#set cg = "%{\e[32m%}" # green
-#set cy = "%{\e[33m%}" # yellow
-#set c0 = "%{\e[0m%}" # recovery
-
-# prompt
-#set promptchars = ">#"
-#if ( $?prompt ) then
-# if ( "$uid" == "0" ) then
-# set prompt = "%B$cr%n%b$c0@$cy%m$cg.%? %B$cr%#%b "
-# else
-# set prompt = "%B$cg%n%b$c0@$cy%m$c0.%? %B$cg%#%b "
-# endif
-#endif
-#set rprompt = "%~"
-
-
-### prompt ###
-set prompt='\
-%B%n%b@%U%m%u %B%S%/%s%b\
-%B%#%b '
-# Prompt used when waiting for stufffor 'for' or 'while'...
-set prompt2="%R? "
-# Prompt used when correcting.
-set prompt3="CORRECT> %B%R%b (y|n|e)? "
-
-
-### bindkey ###
-# Credit: http://www.ibb.net/~anne/keyboard.html
-bindkey '\e[1~' beginning-of-line # Home
-bindkey '\e[2~' overwrite-mode # Insert
-bindkey '\e[3~' delete-char # Delete
-bindkey '\e[4~' end-of-line # End
-bindkey '\e[7~' beginning-of-line # Home (rxvt)
-bindkey '\e[8~' end-of-line # End (rxvt)
-bindkey '^W' backward-delete-word # Delete
-bindkey -k up history-search-backward # PageUp
-bindkey -k down history-search-forward # PageDown
-
-# Vi-style key bindings
-#bindkey -v
-
-
-### Tcsh settings ###
-set ignoreeof
-set listlinks
-set nobeep
-#set noclobber
-
-set history=512
-set savehist=512
-
-# Format of output string when someone logins or logouts
-set who="%n has %a %l from %M."
-
-set inputmode=insert
-
-set autolist
-set autocorrect
-
-# Use the history of commands to aid expansion.
-set autoexpand
-
-set complete=enhance
-set correct=cmd
-
-#set autologout = (30 5)
-#unset autologout
-
-# Symbolic links are expanded to their true values : chase
-# (possible values 'chase' 'ignore' 'expand')
-set symlinks=chase
-
-# After a 'Ctrl-Z', list all the jobs
-set listjobs
-
-# If the exit value is non-zero, print it
-#set printexitvalue
-
-# Ask for confirmation when 'rm *'
-set rmstar
-
-# Files that are to be ignored from completion.
-set fignore=(.o)
-
-#set time=(8 "\
-#Time spent in user mode (CPU seconds) : %Us\
-#Time spent in kernel mode (CPU seconds) : %Ss\
-#Total time : %Es\
-#CPU utilisation (percentage) : %P\
-#Times the process was swapped : %W\
-#Times of major page faults : %F\
-#Times of minor page faults : %R")
-
-# Before printing prompt after a command, do
-#alias precmd date
-
-# Both 'set -n' and set '\003' styles will work.
-set echo_style=both
-
-
-### Aliases ###
-#alias rm 'rm -iv'
-#alias mv 'mv -iv'
-#alias cp 'cp -iv'
-
-alias la 'ls -lAh'
-alias ll 'ls -lh'
-
-
-## Local settings
-if ( -e ~/.tcshrc.local ) then
- source ~/.tcshrc.local
-endif
-
-
-# vim: set ts=8 sw=4 tw=0 fenc=utf-8 ft=tcsh: #