8d7dfbc4c67557e304700090ad8f3da452c68791
[lab.git] / TipAndDoc / .bashrc
1
2 umask 022   # create new file with '644'
3 ulimit -c 0 # no dump core
4 export PAGER=less
5 export LESS='-FRX -i -P ?f%f:(stdin).  ?lb%lb?L/%L..  [?eEOF:?pb%pb\%..]'
6
7 HISTSIZE=50000
8 HISTFILESIZE=50000
9
10 set -o notify   # notify end of background job immediately
11
12 shopt -s histappend     # append command history instead of overwrite
13 shopt -s checkhash      # check always PATH hash table
14 shopt -s cmdhist        # save multi lines command to one line
15 shopt -s no_empty_cmd_completion    # no complementation with no input
16 shopt -s histverify     # check command history before execute
17
18
19 # view last 30 history or search from last 1000 history
20 function i {
21     if [ "$1" ]; then history 1000 | grep "$@"; else history 30; fi
22 }
23
24 # view last 30 history or search from all history
25 function I {
26     if [ "$1" ]; then history | grep "$@"; else history 30; fi
27 }
28
29 if [ -f $BASH_COMPLETION_DIR/git -o -f $BASH_COMPLETION_COMPAT_DIR/git \
30      -o -f $BASH_COMPLETION_COMPAT_DIR/git-prompt ]; then
31     export PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w$(__git_ps1)\$ '
32 else
33     export PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
34 fi
35
36 if [ -d $HOME/bin -a `echo $PATH | grep -c $HOME/bin` -eq 0 ]; then
37     export PATH=$PATH:$HOME/bin
38 fi
39
40 function svnst {
41     svn st $@ | grep "^[^?]"
42 }
43
44 function hexcmp {
45     cmp -l "$@" | awk '{printf "%08X %02X %02X\n", $1-1, strtonum(0$2), strtonum(0$3)}'
46 }
47
48 alias vi='vim'
49 alias sudo='sudo -H '
50 alias rm='rm -v'
51 alias screen='screen -U -R'
52 alias mv='mv -i'
53 alias cp='cp -i'