changeset 127:a7484f2c9616

Long-overdue massive reorganization.
author Edho Prima Arief <edho@myconan.net>
date Thu, 27 Oct 2011 16:23:23 +0700
parents 9a15f3d1b5b0
children 66a1d79c4161
files bash hg inputrc rc/bash rc/hg rc/inputrc rc/tcsh rc/tmux rc/vim rc/zsh setup tcsh tmux vim zsh
diffstat 15 files changed, 425 insertions(+), 381 deletions(-) [+]
line wrap: on
line diff
--- a/bash	Wed Oct 26 16:54:25 2011 +0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,92 +0,0 @@
-#!/usr/bin/env bash
-
-if [ "${ECOS_BASH_LOADED}" != "yes" ]; then
-  ECOS_BASH_LOADED="yes"
-else
-  return
-fi
-
-[ -f "${HOME}/.ecos_bash.before" ] && . "${HOME}/.ecos_bash.before"
-
-_org_path="${PATH}"
-export PATH="${HOME}/.ecos_bin:${HOME}/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin"
-
-PS1='[\u@\h \W]\$ '
-#PS1='[\[\e[0;33m\]\u\[\e[0m\]@\[\e[0;32m\]\h\[\e[0m\] \[\e[1;34m\]\W\[\e[0m\]]\$ '
-
-shopt -s histappend
-PROMPT_COMMAND='history -a'
-export HISTFILESIZE=10000
-export HISTCONTROL=ignoredups
-
-export PAGER="less -Rins"
-export EDITOR=vi
-export LANG="en_US.UTF-8"
-unset LS_COLORS
-
-alias less="less -Rins"
-#assuming POSIX grep
-alias fgrep="grep -F"
-alias egrep="grep -E"
-alias ls="ls -F"
-alias rm="rm -i"
-alias rd="rdesktop -g 1280x600 -K -a 16 -z -P -r sound:off -r clipboard:CLIPBOARD -5"
-
-_has_rm_I=
-_has_gnu_ls=
-_has_gnu_grep=
-case "$(uname -s)" in
-  Linux)
-    _has_rm_I=y
-    _has_gnu_ls=y
-    _has_gnu_grep=y
-  ;;
-  SunOS)
-    [ -x /usr/gnu/bin/rm ] && _has_rm_I=y
-    [ -x /usr/gnu/bin/ls ] && _has_gnu_ls=y
-    [ -x /usr/gnu/bin/grep ] && _has_gnu_grep=y
-    [ -d /usr/xpg4/bin ] && PATH="/usr/xpg4/bin:${PATH}"
-    [ -d /opt/csw/bin ] && PATH="/opt/csw/bin:${PATH}"
-    [ -d /opt/csw/sbin ] && PATH="/opt/csw/sbin:${PATH}"
-    [ -d /usr/gnu/bin ] && PATH="/usr/gnu/bin:${PATH}"
-    export PATH
-    alias ping="ping -s"
-    alias ping6="ping -A inet6"
-  ;;
-  FreeBSD)
-    _has_rm_I=y
-    export CLICOLOR=
-    export LSCOLORS=ExGxFxdxCxegedabagExEx
-  ;;
-  OpenBSD)
-    if command -v colorls > /dev/null 2>&1; then
-      export CLICOLOR=
-      alias ls='colorls -F'
-    fi
-  ;;
-  CYGWIN*)
-    export PATH="${PATH}:${_org_path}"
-  ;;
-esac
-
-[ "${_has_rm_I}" = y ] && alias rm="rm -I"
-[ "${_has_gnu_ls}" = y ] && alias ls="ls -F --color=auto"
-[ "${_has_gnu_grep}" = y ] && alias grep="grep --color=auto"
-
-unset _has_rm_I
-unset _has_gnu_ls
-unset _has_gnu_grep
-
-
-case "${TERM}" in
-  xterm*|screen*|dtterm)
-    PROMPT_COMMAND='echo -ne "\033]0;${LOGNAME}@${HOSTNAME}: ${PWD}\007"'
-  ;;
-esac
-
-if command -v vim > /dev/null 2>&1; then
-  alias vi=vim
-  export EDITOR=vim
-fi
-[ -f "${HOME}/.ecos_bash.after" ] && . "${HOME}/.ecos_bash.after"
-
--- a/hg	Wed Oct 26 16:54:25 2011 +0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,16 +0,0 @@
-[ui]
-username = Edho Prima Arief <edho@myconan.net>
-merge = vimdiff
-verbose = true
-
-[merge-tools]
-vimdiff.executable = vim
-vimdiff.args = -d $base $local $output $other +close +close
-
-[extensions]
-#hgext.convert = 
-#progress =
-
-[hostfingerprints]
-bitbucket.org = 81:2b:08:90:dc:d3:71:ee:e0:7c:b4:75:ce:9b:6c:48:94:56:a1:fe
-
--- a/inputrc	Wed Oct 26 16:54:25 2011 +0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,33 +0,0 @@
-#Basic settings
-set bell-style none
-set keymap emacs
-
-#Home/End
-#GNOME Terminal
-"\eOH": beginning-of-line
-"\eOF": end-of-line
-#tmux
-"\e[1~": beginning-of-line
-"\e[4~": end-of-line
-
-#Delete
-"\e[3~": delete-char
-
-#Alt-Left/Right
-#GNOME Terminal
-"\e[1;3D": backward-word
-"\e[1;3C": forward-word
-#tmux
-"\e\e[D": backward-word
-"\e\e[C": forward-word
-
-#Up/Down
-"\e[A": history-search-backward
-"\e[B": history-search-forward
-#GNOME Terminal
-"\eOA": history-search-backward
-"\eOB": history-search-forward
-
-#Misc
-"\C-w": unix-filename-rubout
-
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/rc/bash	Thu Oct 27 16:23:23 2011 +0700
@@ -0,0 +1,92 @@
+#!/usr/bin/env bash
+
+if [ "${ECOS_BASH_LOADED}" != "yes" ]; then
+  ECOS_BASH_LOADED="yes"
+else
+  return
+fi
+
+[ -f "${HOME}/.ecos_bash.before" ] && . "${HOME}/.ecos_bash.before"
+
+_org_path="${PATH}"
+export PATH="${HOME}/.ecos_bin:${HOME}/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin"
+
+PS1='[\u@\h \W]\$ '
+#PS1='[\[\e[0;33m\]\u\[\e[0m\]@\[\e[0;32m\]\h\[\e[0m\] \[\e[1;34m\]\W\[\e[0m\]]\$ '
+
+shopt -s histappend
+PROMPT_COMMAND='history -a'
+export HISTFILESIZE=10000
+export HISTCONTROL=ignoredups
+
+export PAGER="less -Rins"
+export EDITOR=vi
+export LANG="en_US.UTF-8"
+unset LS_COLORS
+
+alias less="less -Rins"
+#assuming POSIX grep
+alias fgrep="grep -F"
+alias egrep="grep -E"
+alias ls="ls -F"
+alias rm="rm -i"
+alias rd="rdesktop -g 1280x600 -K -a 16 -z -P -r sound:off -r clipboard:CLIPBOARD -5"
+
+_has_rm_I=
+_has_gnu_ls=
+_has_gnu_grep=
+case "$(uname -s)" in
+  Linux)
+    _has_rm_I=y
+    _has_gnu_ls=y
+    _has_gnu_grep=y
+  ;;
+  SunOS)
+    [ -x /usr/gnu/bin/rm ] && _has_rm_I=y
+    [ -x /usr/gnu/bin/ls ] && _has_gnu_ls=y
+    [ -x /usr/gnu/bin/grep ] && _has_gnu_grep=y
+    [ -d /usr/xpg4/bin ] && PATH="/usr/xpg4/bin:${PATH}"
+    [ -d /opt/csw/bin ] && PATH="/opt/csw/bin:${PATH}"
+    [ -d /opt/csw/sbin ] && PATH="/opt/csw/sbin:${PATH}"
+    [ -d /usr/gnu/bin ] && PATH="/usr/gnu/bin:${PATH}"
+    export PATH
+    alias ping="ping -s"
+    alias ping6="ping -A inet6"
+  ;;
+  FreeBSD)
+    _has_rm_I=y
+    export CLICOLOR=
+    export LSCOLORS=ExGxFxdxCxegedabagExEx
+  ;;
+  OpenBSD)
+    if command -v colorls > /dev/null 2>&1; then
+      export CLICOLOR=
+      alias ls='colorls -F'
+    fi
+  ;;
+  CYGWIN*)
+    export PATH="${PATH}:${_org_path}"
+  ;;
+esac
+
+[ "${_has_rm_I}" = y ] && alias rm="rm -I"
+[ "${_has_gnu_ls}" = y ] && alias ls="ls -F --color=auto"
+[ "${_has_gnu_grep}" = y ] && alias grep="grep --color=auto"
+
+unset _has_rm_I
+unset _has_gnu_ls
+unset _has_gnu_grep
+
+
+case "${TERM}" in
+  xterm*|screen*|dtterm)
+    PROMPT_COMMAND='echo -ne "\033]0;${LOGNAME}@${HOSTNAME}: ${PWD}\007"'
+  ;;
+esac
+
+if command -v vim > /dev/null 2>&1; then
+  alias vi=vim
+  export EDITOR=vim
+fi
+[ -f "${HOME}/.ecos_bash.after" ] && . "${HOME}/.ecos_bash.after"
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/rc/hg	Thu Oct 27 16:23:23 2011 +0700
@@ -0,0 +1,16 @@
+[ui]
+username = Edho Prima Arief <edho@myconan.net>
+merge = vimdiff
+verbose = true
+
+[merge-tools]
+vimdiff.executable = vim
+vimdiff.args = -d $base $local $output $other +close +close
+
+[extensions]
+#hgext.convert = 
+#progress =
+
+[hostfingerprints]
+bitbucket.org = 81:2b:08:90:dc:d3:71:ee:e0:7c:b4:75:ce:9b:6c:48:94:56:a1:fe
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/rc/inputrc	Thu Oct 27 16:23:23 2011 +0700
@@ -0,0 +1,33 @@
+#Basic settings
+set bell-style none
+set keymap emacs
+
+#Home/End
+#GNOME Terminal
+"\eOH": beginning-of-line
+"\eOF": end-of-line
+#tmux
+"\e[1~": beginning-of-line
+"\e[4~": end-of-line
+
+#Delete
+"\e[3~": delete-char
+
+#Alt-Left/Right
+#GNOME Terminal
+"\e[1;3D": backward-word
+"\e[1;3C": forward-word
+#tmux
+"\e\e[D": backward-word
+"\e\e[C": forward-word
+
+#Up/Down
+"\e[A": history-search-backward
+"\e[B": history-search-forward
+#GNOME Terminal
+"\eOA": history-search-backward
+"\eOB": history-search-forward
+
+#Misc
+"\C-w": unix-filename-rubout
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/rc/tcsh	Thu Oct 27 16:23:23 2011 +0700
@@ -0,0 +1,104 @@
+#!/usr/bin/env tcsh
+[ -e "${HOME}/.ecos_tcsh.before" ] && source "${HOME}/.ecos_tcsh.before"
+umask 22
+limit coredumpsize 0
+
+set prompt="[%B%n@%m %~%b]%# "
+set path=({,/usr}/{bin,sbin} "${HOME}"/{,.ecos_}bin)
+set history=1000
+set savehist=1000
+set nobeep
+set filec
+
+setenv EDITOR vi
+setenv PAGER less
+setenv BLOCKSIZE K
+setenv LC_COLLATE C
+setenv LANG en_US.UTF-8
+
+unset autologout
+unset autoexpand
+unset autolist
+unset ignoreeof
+
+unalias \*
+alias rd "rdesktop -g 1280x700 -K -a 16 -z -P -r sound:off -r clipboard:CLIPBOARD -5"
+alias h history 25
+alias j jobs -l
+alias la ls -A
+alias ll ls -lA
+alias ls ls -F
+alias rm rm -i
+
+if ($?prompt) then
+  set gnuls_opts="--color=auto --group-directories-first -F"
+  set iscolor=0
+  switch (${TERM})
+    case xterm*:
+    case dtterm:
+    case screen*:
+      setenv CLICOLOR 
+      set myhost=`hostname | cut -d '.' -f 1`
+      set prompt="[%{\033[0;33m%}%n%{\033[0m%}@%{\033[0;32m%}%m%{\033[0m%} %{\033[1;34m%}%c%{\033[0m%}]%# "
+      alias mypwd 'printf "%s\n" "${PWD}" | sed -e "s#^${HOME}#~#"'
+      alias precmd 'printf "\033]0;${USER}@${myhost}: %s\007" "`mypwd`"'
+      set iscolor=1
+    breaksw
+  endsw
+
+  if ("$TERM" == "screen") then
+    bindkey '\e[1~' beginning-of-line
+    bindkey '\e[3~' delete-char
+    bindkey '\e[4~' end-of-line
+    bindkey '\e[5~' history-search-backward
+    bindkey '\e[6~' history-search-forward
+    bindkey '\eOD' backward-word
+    bindkey '\eOC' forward-word
+    bindkey '\e\e[D' backward-word
+    bindkey '\e\e[C' forward-word
+  endif
+  bindkey "^W" backward-delete-word
+  bindkey -k up history-search-backward
+  bindkey -k down history-search-forward
+endif
+
+switch (`uname -s`)
+  case FreeBSD:
+    set path=(${path} /usr/local/{bin,sbin})
+    setenv LSCOLORS ExGxFxdxCxegedabagExEx
+    alias ls ls -FG
+    ( which gnuls ) > /dev/null && alias ls gnuls ${gnuls_opts}
+    alias man man -o
+    alias rm rm -I
+    alias top top -P
+  breaksw
+  case NetBSD:
+    set path=(${path} /usr/pkg/{bin,sbin})
+    breaksw
+  case OpenBSD:
+    set path=(${path} /usr/local/{bin,sbin})
+    setenv LSCOLORS ExGxFxdxCxegedabagExEx
+    [ "${iscolor}" -eq 1 ] && setenv TERM xterm-256color
+    ( which colorls ) > /dev/null && alias ls colorls -FG
+  breaksw
+  case DragonFly:
+    set path=(${path} /usr/pkg/{bin,sbin})
+    setenv LSCOLORS ExGxFxdxCxegedabagExEx
+    alias ls ls -FG
+  breaksw
+  case SunOS:
+    set path=(${path} /usr/{gnu,csw,xpg4}/{bin,sbin})
+    [ -x /usr/gnu/bin/ls ] && alias ls /usr/gnu/bin/ls ${gnuls_opts}
+  breaksw
+  case Linux:
+    alias ls ls ${gnuls_opts}
+    alias grep grep --color=auto
+  breaksw
+endsw
+unset gnuls_opts
+
+( which vim ) > /dev/null && alias vi vim && setenv EDITOR vim
+
+[ -e "${HOME}/.ecos_tcsh.after" ] && source "${HOME}/.ecos_tcsh.after"
+
+[ -x "/usr/games/fortune" ] && "/usr/games/fortune"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/rc/tmux	Thu Oct 27 16:23:23 2011 +0700
@@ -0,0 +1,29 @@
+##PRE-1.4
+#set -g terminal-overrides '*:acsc@'
+
+##UNDEFINED. NEED CHECK WHICH VERSION
+set -g repeat-time 0
+set -g status-bg blue
+set -g status-fg white
+
+set -g status-left '[#S]'
+set -g status-left-attr bold
+set -g status-left-fg yellow
+
+set -g status-right '#[fg=yellow,bold]#H | %b-%d %H:%M '
+
+set -g status-utf8 on
+setw -g utf8 on
+
+#set -g pane-border-bg black
+#set -g pane-border-fg white
+#set -g pane-active-border-bg black
+set -g pane-active-border-fg blue
+
+set -g set-titles on
+set -g set-titles-string '[#S] #I:#W #T'
+
+setw -g window-status-current-bg red
+setw -g window-status-current-fg white
+setw -g window-status-current-format '#I:#W'
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/rc/vim	Thu Oct 27 16:23:23 2011 +0700
@@ -0,0 +1,29 @@
+set showmode
+set showcmd
+set nomodeline
+set autoindent
+set lazyredraw
+set vb t_vb=
+set ruler
+set nohls
+set nocompatible
+set backspace=2
+set esckeys
+set noerrorbells
+syntax on
+set ts=2
+set expandtab
+set title
+
+map <C-t><up> :tabr<cr>
+map <C-t><down> :tabl<cr>
+map <C-t><left> :tabp<cr>
+map <C-t><right> :tabn<cr>
+map <C-t>p :tabp<cr>
+map <C-t>n :tabn<cr>
+map <C-t><C-t> :NERDTreeToggle<cr>
+map <C-t><C-m> :NERDTreeMirror<cr>
+
+"autocmd VimEnter * NERDTree
+"autocmd BufEnter * NERDTreeMirror
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/rc/zsh	Thu Oct 27 16:23:23 2011 +0700
@@ -0,0 +1,26 @@
+#!/usr/bin/env zsh
+[ -f "${HOME}/.ecos_zsh.before" ] && . "${HOME}/.ecos_zsh.before"
+case $TERM in
+  xterm*|screen*)
+    precmd () {print -Pn "\e]0;%n@%m: %~\a"}
+  ;;
+esac
+PS1='[%n@%m %~]%% '
+export PATH="${HOME}/.ecos_bin:${PATH}"
+HISTFILE=~/.histfile
+HISTSIZE=10000
+SAVEHIST=10000
+setopt appendhistory nomatch
+unsetopt autocd beep extendedglob notify
+bindkey -e
+bindkey '^[[A' history-search-backward
+bindkey '^[[B' history-search-forward
+
+autoload -Uz compinit
+compinit
+
+export EDITOR=vi
+export PAGER='less -Rins'
+alias less='less -Rins'
+alias ls='ls -F'
+[ -f "${HOME}/.ecos_zsh.after" ] && . "${HOME}/.ecos_zsh.after"
--- a/setup	Wed Oct 26 16:54:25 2011 +0700
+++ b/setup	Thu Oct 27 16:23:23 2011 +0700
@@ -1,34 +1,97 @@
 #!/bin/sh
 
-install() {
-  uninstall
-  #create symlinks
-  linker "tcsh" ".ecos_tcsh"
-  linker "bash" ".ecos_bash"
-  linker "zsh" ".ecos_zsh"
-  linker "tmux" ".tmux.conf"
-  linker "hg" ".hgrc"
-  linker "vim" ".vimrc"
-  linker "inputrc" ".inputrc"
-  #originally bin-ec. Renamed to .ecos.bin for sanity when listing home
-  #and replaced . with _ for more sanity
-  linker "bin" ".ecos_bin"
+basedir="`dirname "${0}"`"
+cd "${basedir}"
+basedir="`pwd`"
+rcdir="${basedir}/rc"
+bindir="${basedir}/bin"
+
+test -n "${HOME}" || exit 1
+
+_echo() {
+  _echon "${*}"; printf "\n"
+}
+_echon() {
+  printf "%s" "${*}"
+}
+
+_tcsh() {
+  case "$1" in
+    uninstall|install)
+      _rc "${1}" "tcsh" ".ecos_tcsh"
+      _init "${1}" '[ -r "${HOME}/.ecos_tcsh" ] && source "${HOME}/.ecos_tcsh" #ECCORE_TCSH' ".cshrc"
+    ;;
+  esac
+}
+
+_bash() {
+  case "$1" in
+    uninstall|install)
+      _rc "${1}" "bash" ".ecos_bash"
+     _init "${1}" '[ -r "${HOME}/.ecos_bash" ] && . "${HOME}/.ecos_bash" #ECCORE_BASH' ".bash_profile"
+     _init "${1}" '[ -r "${HOME}/.ecos_bash" ] && . "${HOME}/.ecos_bash" #ECCORE_BASH' ".bashrc"
+    ;;
+  esac
+}
 
-  #modify cshrc
-  echo '[ -r "${HOME}/.ecos_tcsh" ] && source "${HOME}/.ecos_tcsh" #ECCORE_TCSH' >> "${HOME}/.cshrc"
-  #modify bash_profile and bashrc
-  echo '[ -r "${HOME}/.ecos_bash" ] && . "${HOME}/.ecos_bash" #ECCORE_BASH' >> "${HOME}/.bash_profile"
-  echo '[ -r "${HOME}/.ecos_bash" ] && . "${HOME}/.ecos_bash" #ECCORE_BASH' >> "${HOME}/.bashrc"
-  #modify zshrc
-  echo '[ -r "${HOME}/.ecos_zsh" ] && . "${HOME}/.ecos_zsh" #ECCORE_ZSH' >> "${HOME}/.zshrc"
+_zsh() {
+  case "$1" in
+    uninstall|install)
+      _rc "${1}" "zsh" ".ecos_zsh"
+      _init "${1}" '[ -r "${HOME}/.ecos_zsh" ] && . "${HOME}/.ecos_zsh" #ECCORE_ZSH' ".zshrc"
+    ;;
+  esac
+}
+
+_rc() {
+  _srcfile="${rcdir}/${2}"
+  _dstfile="${HOME}/${3}"
+  if test ! -h "${_dstfile}"; then
+    if test -f "${_dstfile}"; then
+      cp "${_dstfile}" "${_dstfile}.bak"
+    elif test -d "${_dstfile}"; then
+      cp -r "${_dstfile}" "${_dstfile}.bak"
+    fi
+    _echo "${_dstfile} backed up to ${_dstfile}.bak"
+  fi
+  rm -f "${_dstfile}"
+  case "${1}" in
+    install)
+      ln -fs "${_srcfile}" "${_dstfile}"
+      _echo "Installed ${_dstfile}"
+    ;;
+    uninstall)
+      _echo "Removed ${_dstfile}"
+    ;;
+  esac
+}
+
+_init() {
+  _script="${HOME}/${3}"
+  _scripttmp="${HOME}/.tmp.${3}"
+  _data="${2}"
+  if [ -f "${_script}" ]; then
+    grep -v "${_data}" "${_script}" > "${_scripttmp}"
+    mv -f "${_scripttmp}" "${_script}"
+  fi
+  case "${1}" in
+    install)
+      _echo "${_data}" >> "${_script}"
+      _echo "Added autostart to ${_script}"
+    ;;
+    uninstall)
+      _echo "Removed autostart from ${_script}"
+    ;;
+  esac
 }
 
 linker() {
   echo "Creating symlink: ${1} => ~/${2}"
+  [ -f "${1}" ] && rm "${PWD}/$"
   ln -fs "${PWD}/${1}" "${HOME}/${2}"
 }
 
-uninstall_init() {
+_uninstall_init() {
   script="${1}"
   scripttmp="${1}.new.tmp"
   hashdata="${2}"
@@ -38,43 +101,24 @@
   fi
 }
 
-uninstall() {
-  for i in .ecos_tcsh .tmux.conf .hgrc .vimrc .inputrc bin-ec .ecos.bin .ecos_bin .ecos_bash .ecos_zsh; do
-    if [ -e "${HOME}/${i}" ]; then
-      echo "Removing file: ~/${i}"
-      rm -f "${HOME}/${i}"
-    fi
-  done
-  uninstall_init "${HOME}/.cshrc" "#ECCORE_TCSH"
-  uninstall_init "${HOME}/.bashrc" "#ECCORE_BASH"
-  uninstall_init "${HOME}/.bash_profile" "#ECCORE_BASH"
-  uninstall_init "${HOME}/.zshrc" "#ECCORE_ZSH"
-}
-
-update() {
-  if [ -f "${HOME}/.tcsh_exec" ]; then
-    mv -f "${HOME}/.tcsh_exec" "${HOME}/.ecos_tcsh.after"
-    echo "Moved: ${HOME}/.tcsh_exec => ${HOME}/.ecos_tcsh.after"
-  fi
-}
-
-help() {
+_help() {
   cat <<EOF
 Usage: ${0} [install|uninstall]
 EOF
 }
 
-case "$1" in
-  install)
-    install
-  ;;
-  uninstall)
-    uninstall
-  ;;
-  update)
-    update
+case "${1}" in
+  install|uninstall)
+    for i in tcsh bash zsh; do
+      _"${i}" "${1}"
+    done
+    _rc "${1}" "tmux" ".tmux.conf"
+    _rc "${1}" "hg" ".hgrc"
+    _rc "${1}" "vim" ".vimrc"
+    _rc "${1}" "inputrc" ".inputrc"
+    _rc "${1}" "bin" ".ecos_bin"
   ;;
   *)
-    help
+    _help
   ;;
 esac
--- a/tcsh	Wed Oct 26 16:54:25 2011 +0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,104 +0,0 @@
-#!/usr/bin/env tcsh
-[ -e "${HOME}/.ecos_tcsh.before" ] && source "${HOME}/.ecos_tcsh.before"
-umask 22
-limit coredumpsize 0
-
-set prompt="[%B%n@%m %~%b]%# "
-set path=({,/usr}/{bin,sbin} "${HOME}"/{,.ecos_}bin)
-set history=1000
-set savehist=1000
-set nobeep
-set filec
-
-setenv EDITOR vi
-setenv PAGER less
-setenv BLOCKSIZE K
-setenv LC_COLLATE C
-setenv LANG en_US.UTF-8
-
-unset autologout
-unset autoexpand
-unset autolist
-unset ignoreeof
-
-unalias \*
-alias rd "rdesktop -g 1280x700 -K -a 16 -z -P -r sound:off -r clipboard:CLIPBOARD -5"
-alias h history 25
-alias j jobs -l
-alias la ls -A
-alias ll ls -lA
-alias ls ls -F
-alias rm rm -i
-
-if ($?prompt) then
-  set gnuls_opts="--color=auto --group-directories-first -F"
-  set iscolor=0
-  switch (${TERM})
-    case xterm*:
-    case dtterm:
-    case screen*:
-      setenv CLICOLOR 
-      set myhost=`hostname | cut -d '.' -f 1`
-      set prompt="[%{\033[0;33m%}%n%{\033[0m%}@%{\033[0;32m%}%m%{\033[0m%} %{\033[1;34m%}%c%{\033[0m%}]%# "
-      alias mypwd 'printf "%s\n" "${PWD}" | sed -e "s#^${HOME}#~#"'
-      alias precmd 'printf "\033]0;${USER}@${myhost}: %s\007" "`mypwd`"'
-      set iscolor=1
-    breaksw
-  endsw
-
-  if ("$TERM" == "screen") then
-    bindkey '\e[1~' beginning-of-line
-    bindkey '\e[3~' delete-char
-    bindkey '\e[4~' end-of-line
-    bindkey '\e[5~' history-search-backward
-    bindkey '\e[6~' history-search-forward
-    bindkey '\eOD' backward-word
-    bindkey '\eOC' forward-word
-    bindkey '\e\e[D' backward-word
-    bindkey '\e\e[C' forward-word
-  endif
-  bindkey "^W" backward-delete-word
-  bindkey -k up history-search-backward
-  bindkey -k down history-search-forward
-endif
-
-switch (`uname -s`)
-  case FreeBSD:
-    set path=(${path} /usr/local/{bin,sbin})
-    setenv LSCOLORS ExGxFxdxCxegedabagExEx
-    alias ls ls -FG
-    ( which gnuls ) > /dev/null && alias ls gnuls ${gnuls_opts}
-    alias man man -o
-    alias rm rm -I
-    alias top top -P
-  breaksw
-  case NetBSD:
-    set path=(${path} /usr/pkg/{bin,sbin})
-    breaksw
-  case OpenBSD:
-    set path=(${path} /usr/local/{bin,sbin})
-    setenv LSCOLORS ExGxFxdxCxegedabagExEx
-    [ "${iscolor}" -eq 1 ] && setenv TERM xterm-256color
-    ( which colorls ) > /dev/null && alias ls colorls -FG
-  breaksw
-  case DragonFly:
-    set path=(${path} /usr/pkg/{bin,sbin})
-    setenv LSCOLORS ExGxFxdxCxegedabagExEx
-    alias ls ls -FG
-  breaksw
-  case SunOS:
-    set path=(${path} /usr/{gnu,csw,xpg4}/{bin,sbin})
-    [ -x /usr/gnu/bin/ls ] && alias ls /usr/gnu/bin/ls ${gnuls_opts}
-  breaksw
-  case Linux:
-    alias ls ls ${gnuls_opts}
-    alias grep grep --color=auto
-  breaksw
-endsw
-unset gnuls_opts
-
-( which vim ) > /dev/null && alias vi vim && setenv EDITOR vim
-
-[ -e "${HOME}/.ecos_tcsh.after" ] && source "${HOME}/.ecos_tcsh.after"
-
-[ -x "/usr/games/fortune" ] && "/usr/games/fortune"
--- a/tmux	Wed Oct 26 16:54:25 2011 +0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,29 +0,0 @@
-##PRE-1.4
-#set -g terminal-overrides '*:acsc@'
-
-##UNDEFINED. NEED CHECK WHICH VERSION
-set -g repeat-time 0
-set -g status-bg blue
-set -g status-fg white
-
-set -g status-left '[#S]'
-set -g status-left-attr bold
-set -g status-left-fg yellow
-
-set -g status-right '#[fg=yellow,bold]#H | %b-%d %H:%M '
-
-set -g status-utf8 on
-setw -g utf8 on
-
-#set -g pane-border-bg black
-#set -g pane-border-fg white
-#set -g pane-active-border-bg black
-set -g pane-active-border-fg blue
-
-set -g set-titles on
-set -g set-titles-string '[#S] #I:#W #T'
-
-setw -g window-status-current-bg red
-setw -g window-status-current-fg white
-setw -g window-status-current-format '#I:#W'
-
--- a/vim	Wed Oct 26 16:54:25 2011 +0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,29 +0,0 @@
-set showmode
-set showcmd
-set nomodeline
-set autoindent
-set lazyredraw
-set vb t_vb=
-set ruler
-set nohls
-set nocompatible
-set backspace=2
-set esckeys
-set noerrorbells
-syntax on
-set ts=2
-set expandtab
-set title
-
-map <C-t><up> :tabr<cr>
-map <C-t><down> :tabl<cr>
-map <C-t><left> :tabp<cr>
-map <C-t><right> :tabn<cr>
-map <C-t>p :tabp<cr>
-map <C-t>n :tabn<cr>
-map <C-t><C-t> :NERDTreeToggle<cr>
-map <C-t><C-m> :NERDTreeMirror<cr>
-
-"autocmd VimEnter * NERDTree
-"autocmd BufEnter * NERDTreeMirror
-
--- a/zsh	Wed Oct 26 16:54:25 2011 +0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,26 +0,0 @@
-#!/usr/bin/env zsh
-[ -f "${HOME}/.ecos_zsh.before" ] && . "${HOME}/.ecos_zsh.before"
-case $TERM in
-  xterm*|screen*)
-    precmd () {print -Pn "\e]0;%n@%m: %~\a"}
-  ;;
-esac
-PS1='[%n@%m %~]%% '
-export PATH="${HOME}/.ecos_bin:${PATH}"
-HISTFILE=~/.histfile
-HISTSIZE=10000
-SAVEHIST=10000
-setopt appendhistory nomatch
-unsetopt autocd beep extendedglob notify
-bindkey -e
-bindkey '^[[A' history-search-backward
-bindkey '^[[B' history-search-forward
-
-autoload -Uz compinit
-compinit
-
-export EDITOR=vi
-export PAGER='less -Rins'
-alias less='less -Rins'
-alias ls='ls -F'
-[ -f "${HOME}/.ecos_zsh.after" ] && . "${HOME}/.ecos_zsh.after"