.bashrc
author Oleksandr Gavenko <gavenkoa@gmail.com>
Sat, 03 Apr 2010 11:09:46 +0300
changeset 55 8fd48debf4cc
parent 45 5c94d2613433
child 57 99d0eb7974d6
permissions -rw-r--r--
Point to 'C-x C-e' command in bash.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
11
339675ac5fd3 Base version of .bashrc.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     1
339675ac5fd3 Base version of .bashrc.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     2
# XXX
339675ac5fd3 Base version of .bashrc.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     3
# [ -f /etc/bashrc ] && . /etc/bashrc
339675ac5fd3 Base version of .bashrc.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     4
339675ac5fd3 Base version of .bashrc.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     5
# XXX for mc, cvs, svn, ...
339675ac5fd3 Base version of .bashrc.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     6
# export EDITOR=vim
339675ac5fd3 Base version of .bashrc.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     7
339675ac5fd3 Base version of .bashrc.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     8
# XXX vim and gnome-terminal have support for 256 colours in fedora 8 at least
339675ac5fd3 Base version of .bashrc.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     9
# Note debian/ubuntu users should install the ncurses-term package to support this
339675ac5fd3 Base version of .bashrc.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    10
# export TERM=xterm-256color
339675ac5fd3 Base version of .bashrc.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    11
339675ac5fd3 Base version of .bashrc.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    12
# XXX highlight $HOST:$PWD prompt
339675ac5fd3 Base version of .bashrc.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    13
# PS1='\[\e[1m\]\h:\w\$\[\e[0m\] '
17
e11e0adb941b More verbose prompt, to prevent tangling with another shells.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 16
diff changeset
    14
PS1='bash# '
11
339675ac5fd3 Base version of .bashrc.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    15
41
d410aac55409 Easy cd to often used dirs.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 34
diff changeset
    16
# Easy cd to often used dirs.
d410aac55409 Easy cd to often used dirs.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 34
diff changeset
    17
export CDPATH=.:~:~/devel:~/devel/gav-devel
d410aac55409 Easy cd to often used dirs.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 34
diff changeset
    18
11
339675ac5fd3 Base version of .bashrc.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    19
# Don't store duplicate adjacent items in the history.
339675ac5fd3 Base version of .bashrc.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    20
#   ignorespace     do not save lines that start with space
339675ac5fd3 Base version of .bashrc.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    21
#   erasedups       all previous lines matching the current line to be removed from
339675ac5fd3 Base version of .bashrc.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    22
#                   the history list before that line is saved
339675ac5fd3 Base version of .bashrc.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    23
HISTCONTROL=igrorespace:erasedups
339675ac5fd3 Base version of .bashrc.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    24
339675ac5fd3 Base version of .bashrc.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    25
# Don't store noisy/dumb items.
42
8c7465d5f94d Improve HISTIGNORE.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 41
diff changeset
    26
HISTIGNORE=" ?cd *":"e *":"sudo mv *":"sudo rm *":"sudo cp *":"sudo mkdir *":"sudo chmod *":"sudo chown *":"ls ?*":pwd:"vlc*"
11
339675ac5fd3 Base version of .bashrc.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    27
339675ac5fd3 Base version of .bashrc.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    28
# To these options assigned default value, as they satisfy my needs I comment them.
339675ac5fd3 Base version of .bashrc.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    29
# HISTFILE=~/.bash_history  # where is command history stored
339675ac5fd3 Base version of .bashrc.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    30
# HISTFILESIZE=500          # how many lines been in $HISTFILE
339675ac5fd3 Base version of .bashrc.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    31
# HISTSIZE=500              # how many lines been stored in bash process
339675ac5fd3 Base version of .bashrc.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    32
339675ac5fd3 Base version of .bashrc.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    33
# Can be XXX /visible. I like bell.
339675ac5fd3 Base version of .bashrc.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    34
# set bell-style visible
339675ac5fd3 Base version of .bashrc.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    35
28
da6841fb89e9 Minor errors in the spelling of a directory component in a cd command will be corrected.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 16
diff changeset
    36
# Minor errors in the spelling of a directory component in a cd command will
da6841fb89e9 Minor errors in the spelling of a directory component in a cd command will be corrected.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 16
diff changeset
    37
# be corrected.
da6841fb89e9 Minor errors in the spelling of a directory component in a cd command will be corrected.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 16
diff changeset
    38
shopt -s cdspell
11
339675ac5fd3 Base version of .bashrc.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    39
43
6c53a61678d7 Added useful bash settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 42
diff changeset
    40
# Save all lines of a multiple-line command in the same history entry.
6c53a61678d7 Added useful bash settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 42
diff changeset
    41
shopt -s cmdhist
6c53a61678d7 Added useful bash settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 42
diff changeset
    42
6c53a61678d7 Added useful bash settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 42
diff changeset
    43
# Allows files beginning with a dot ('.') to be returned in the results of path-name expansion.
6c53a61678d7 Added useful bash settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 42
diff changeset
    44
shopt -s dotglob
6c53a61678d7 Added useful bash settings.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 42
diff changeset
    45
11
339675ac5fd3 Base version of .bashrc.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    46
# Adjust settings according to current terminal window width
339675ac5fd3 Base version of .bashrc.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    47
# which may have changed while the last command was running
339675ac5fd3 Base version of .bashrc.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    48
# (which is a common occurance for vim/less/etc.)
339675ac5fd3 Base version of .bashrc.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    49
# Note this is already set in /etc/bashrc on Fedora 8 at least.
339675ac5fd3 Base version of .bashrc.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    50
shopt -s checkwinsize
339675ac5fd3 Base version of .bashrc.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    51
339675ac5fd3 Base version of .bashrc.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    52
# Let me have core dumps
339675ac5fd3 Base version of .bashrc.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    53
ulimit -c unlimited
339675ac5fd3 Base version of .bashrc.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    54
44
e4703f904e4b Use bash-completion, if available.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 43
diff changeset
    55
################################################################
11
339675ac5fd3 Base version of .bashrc.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    56
# shortcut aliases
339675ac5fd3 Base version of .bashrc.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    57
339675ac5fd3 Base version of .bashrc.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    58
alias ..="cd .."        #go to parent dir
339675ac5fd3 Base version of .bashrc.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    59
alias ...="cd ../.."    #go to grandparent dir
339675ac5fd3 Base version of .bashrc.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    60
alias -- -="cd -"       #go to previous dir
339675ac5fd3 Base version of .bashrc.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    61
alias l.='ls -d .*'     #list hidden files
339675ac5fd3 Base version of .bashrc.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    62
alias ll='ls -lhrt'     #extra info compared to "l"
339675ac5fd3 Base version of .bashrc.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    63
alias lld='ls -lUd */'  #list directories
339675ac5fd3 Base version of .bashrc.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    64
339675ac5fd3 Base version of .bashrc.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    65
# make and change to a directory
339675ac5fd3 Base version of .bashrc.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    66
md () { mkdir -p "$1" && cd "$1"; }
339675ac5fd3 Base version of .bashrc.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    67
339675ac5fd3 Base version of .bashrc.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    68
# GREP_COLOR=bright yellow on black bg.
339675ac5fd3 Base version of .bashrc.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    69
# use GREP_COLOR=7 to highlight whitespace on black terminals
339675ac5fd3 Base version of .bashrc.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    70
# LANG=C for speed. See also: http://www.pixelbeat.org/scripts/findrepo
339675ac5fd3 Base version of .bashrc.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    71
# alias grep='GREP_COLOR="1;33;40" LANG=C grep --color=auto'
339675ac5fd3 Base version of .bashrc.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    72
339675ac5fd3 Base version of .bashrc.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    73
# alias ls="BLOCK_SIZE=\'1 ls --color=auto" #enable thousands grouping and colour
339675ac5fd3 Base version of .bashrc.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    74
# alias minicom='minicom -c on' #enable colour
339675ac5fd3 Base version of .bashrc.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    75
# alias cal='cal -3' #show 3 months by default
339675ac5fd3 Base version of .bashrc.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    76
# alias units='units -t' #terse mode
339675ac5fd3 Base version of .bashrc.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    77
# alias diff='LC_ALL=C TZ=GMT0 diff -Naur' #normalise diffs for distribution
339675ac5fd3 Base version of .bashrc.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    78
# alias lynx='lynx -force_html -width=$COLUMNS' #best settings for viewing HTML
339675ac5fd3 Base version of .bashrc.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    79
# alias links='links -force-html' #need to enable colour in config menu manually
339675ac5fd3 Base version of .bashrc.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    80
# alias xterm='xterm -fb "" -bg black -fg gray -fa "Sans Mono" -fs 10 +sb -sl 3000 -g 80x50+1+1'
339675ac5fd3 Base version of .bashrc.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    81
# alias sudo='sudo env PATH=$PATH' #work around sudo built --with-secure-path (ubuntu)
339675ac5fd3 Base version of .bashrc.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    82
# alias vim='vim -X' #don't try to contact xserver (which can hang on network issues)
339675ac5fd3 Base version of .bashrc.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    83
# alias gdb='gdb -tui' #enable the text window interface if possible
339675ac5fd3 Base version of .bashrc.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    84
339675ac5fd3 Base version of .bashrc.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    85
# what most people want from od (hexdump)
339675ac5fd3 Base version of .bashrc.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    86
# alias hd='od -Ax -tx1z -v'
339675ac5fd3 Base version of .bashrc.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    87
45
5c94d2613433 Added alias for reindent code for our job rules.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 44
diff changeset
    88
alias indent-bifit="indent -bap -bbo -br -brs -cdb -cdw -ce -cli0 -c0 -cs -d0 -di0 -hnl -l120 -lc90 -i4 -npcs -ppi 3 -npsl -nut -sbi4 -sc"
5c94d2613433 Added alias for reindent code for our job rules.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 44
diff changeset
    89
11
339675ac5fd3 Base version of .bashrc.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    90
# canonicalize path (including resolving symlinks)
339675ac5fd3 Base version of .bashrc.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    91
# alias realpath='readlink -f'
32
031655c93305 Special case for CYGWIN to properly display russian letters in rxvt.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 30
diff changeset
    92
44
e4703f904e4b Use bash-completion, if available.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 43
diff changeset
    93
# Use bash-completion, if available.
e4703f904e4b Use bash-completion, if available.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 43
diff changeset
    94
if [ -f /etc/bash_completion ]; then
e4703f904e4b Use bash-completion, if available.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 43
diff changeset
    95
  . /etc/bash_completion
e4703f904e4b Use bash-completion, if available.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 43
diff changeset
    96
fi
e4703f904e4b Use bash-completion, if available.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 43
diff changeset
    97
if [ -f $HOME/usr/etc/bash_completion ]; then
e4703f904e4b Use bash-completion, if available.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 43
diff changeset
    98
  . $HOME/usr/etc/bash_completion
e4703f904e4b Use bash-completion, if available.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 43
diff changeset
    99
fi
e4703f904e4b Use bash-completion, if available.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 43
diff changeset
   100
32
031655c93305 Special case for CYGWIN to properly display russian letters in rxvt.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 30
diff changeset
   101
# Special case for CYGWIN to properly display russian letters in rxvt.
34
cddddb009921 Added useful comment.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 32
diff changeset
   102
# Don't forget set in Windows SHELL=/bin/bash. If default SHELL is sh then .bashrc will not be read.
32
031655c93305 Special case for CYGWIN to properly display russian letters in rxvt.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 30
diff changeset
   103
if [ -n "$COMSPEC" ]; then
031655c93305 Special case for CYGWIN to properly display russian letters in rxvt.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 30
diff changeset
   104
  if [ x$OSTYPE = xcygwin ]; then
031655c93305 Special case for CYGWIN to properly display russian letters in rxvt.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 30
diff changeset
   105
    export LANG=ru_RU.CP1251
031655c93305 Special case for CYGWIN to properly display russian letters in rxvt.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 30
diff changeset
   106
  fi
031655c93305 Special case for CYGWIN to properly display russian letters in rxvt.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 30
diff changeset
   107
fi