root/dotfiles/bash/kana/dot.bashrc

Revision 520, 3.6 kB (checked in by kana, 13 months ago)

dotfiles/bash/kana:
* Sync with my local repository.

  • Property svn:keywords set to Id
Line 
1# $Id$
2# MISC.  {{{1
3
4umask 077  # Default permission
5ulimit -c 0  # Don't create core file
6
7
8export CDPATH="$(echo . ~/freq{,/latest{,/working,/u}} | tr ' ' ':')"
9
10# For Subversion via SSH.
11if [ "${PATH/$HOME/}" = "$PATH" ]; then  # if $HOME/bin is not in $PATH ...
12  PATH="$HOME/bin:$PATH"
13fi
14
15
16# Default values:
17#   On:
18#     cmdhist extquote force_fignore hostcomplete
19#     interactive_comments progcomp promptvars sourcepath
20#   Off:
21#     cdable_vars cdspell checkhash checkwinsize dotglob execfail extdebug
22#     extglob failglob gnu_errfmt histappend histreedit histverify huponexit
23#     igncr lithist mailwarn no_empty_cmd_completion nocaseglob nocasematch
24#     nullglob shift_verbose xpg_echo
25#   Differ for each instance:
26#     expand_aliases login_shell restricted_shell
27shopt -s checkwinsize                   # Auto recognizing window size
28shopt -s histappend                     # Don't overwrite HISTFILE
29shopt -s no_empty_cmd_completion        # Don't complete when empty line
30shopt -u hostcomplete                   # Don't complete hostname
31shopt -u sourcepath                     # Don't search PATH for `source'
32
33
34
35
36# HISTORY
37
38HISTSIZE=50000  # History size at runtime
39HISTFILESIZE=$HISTSIZE  # History size to save
40
41# Don't save lines which are matched to these patterns:
42# 1. Same as the previous line.
43# 2. Starts with a whitespace.
44HISTIGNORE='&: *'
45
46
47
48
49# PROMPT
50#
51# user@host cwd (shlvl)
52# $
53
54_set_up_prompt() {
55  local _c_reset='\[\e[0m\]'
56  local _c_cyan='\[\e[36m\]'
57  local _c_green='\[\e[32m\]'
58  local _c_red='\[\e[31m\]'
59  local _c_yellow='\[\e[33m\]'
60
61  local _c_user
62  case "$USER" in
63    root) _c_user="$_c_red" ;;
64    *) _c_user="$_c_green" ;;
65  esac
66  local _c_host
67  case "$HOSTNAME" in
68    colinux) _c_host="$_c_cyan" ;;
69    *)
70      if [ "$ENV_WORKING" != "$ENV_ACCESS" ]; then
71        _c_host="$_c_cyan"
72      else
73        _c_host="$_c_green"
74      fi
75      ;;
76  esac
77
78  local _prompt_title='\[\e]0;\u@\h \w\007\]'
79  local _prompt_host="$_c_user\\u$_c_reset$_c_host@\\h$_c_reset"
80  local _prompt_cwd="$_c_yellow\\w$_c_reset"
81  local _prompt_main='\$ '
82  if [[ 2 -le $SHLVL ]]; then  # is nested interactive shell?
83    local _prompt_shlvl=' ($SHLVL)'
84  else
85    local _prompt_shlvl=''
86  fi
87  if [ -n "$WINDOW" ]; then  # auto-title in GNU screen
88    local _prompt_auto='\ek\e\\'
89  else
90    local _prompt_auto=''
91  fi
92
93  PS1="$_prompt_title
94$_prompt_host $_prompt_cwd$_prompt_shlvl
95$_prompt_main$_prompt_auto"
96}
97
98_set_up_prompt
99
100unset -f _set_up_prompt
101
102
103
104
105
106
107
108
109# ALIASES  {{{1
110
111alias ls='ls --show-control-chars --color=auto'
112alias la='ls -a'
113alias ll='ls -l'
114alias lal='ls -al'
115alias lla='ls -la'
116alias altr='ls -altr'
117
118alias v='vim'
119
120alias ..='cd ..'
121
122if [ "$ENV_WORKING" = 'colinux' ]; then
123  alias umount-c='sudo umount /c'
124  alias mount-c='mount-c-smbfs'
125  alias mount-c-cofs='sudo mount -t cofs cofs0 /c -o defaults,noatime,noexec,user,uid=$USER,gid=users'
126  alias mount-c-smbfs='sudo mount -t smbfs "//windows/C\$" /c -o defaults,noatime,user,uid=$USER,gid=users,fmask=0644,dmask=0755,username=$USER'
127
128  alias shutdown-colinux='sudo halt; exit'
129fi
130
131
132
133
134
135
136
137
138# ETC  {{{1
139
140source ~/.bash.d/cdhist.sh
141
142
143case "$ENV_WORKING" in
144  cygwin|linux)
145    BASH_COMPLETION=~/.bash.d/bash_completion
146    BASH_COMPLETION_DIR=~/.bash.d/NO_SUCH_DIR  # Don't use contrib for this.
147    ;;
148  colinux)
149    BASH_COMPLETION=/etc/bash_completion
150    # BASH_COMPLETION_DIR=...  # Don't set - use the default value.
151    ;;
152  *)
153    # NOP
154    ;;
155esac
156if [ -n "$BASH_COMPLETION" ] && [ -r "$BASH_COMPLETION" ]; then
157  source "$BASH_COMPLETION"
158fi
159
160
161complete -C ~/.bash.d/svk-completion.pl -o default svk
162
163
164
165
166
167
168
169
170# __END__
171# vim: filetype=sh foldmethod=marker
Note: See TracBrowser for help on using the browser.