.bashrc
author Oleksandr Gavenko <gavenkoa@gmail.com>
Thu, 15 Apr 2010 21:34:06 +0300
changeset 56 47272014a49a
parent 45 5c94d2613433
child 57 99d0eb7974d6
permissions -rw-r--r--
Don't use fvwm under Cygwin.


# XXX
# [ -f /etc/bashrc ] && . /etc/bashrc

# XXX for mc, cvs, svn, ...
# export EDITOR=vim

# XXX vim and gnome-terminal have support for 256 colours in fedora 8 at least
# Note debian/ubuntu users should install the ncurses-term package to support this
# export TERM=xterm-256color

# XXX highlight $HOST:$PWD prompt
# PS1='\[\e[1m\]\h:\w\$\[\e[0m\] '
PS1='bash# '

# Easy cd to often used dirs.
export CDPATH=.:~:~/devel:~/devel/gav-devel

# Don't store duplicate adjacent items in the history.
#   ignorespace     do not save lines that start with space
#   erasedups       all previous lines matching the current line to be removed from
#                   the history list before that line is saved
HISTCONTROL=igrorespace:erasedups

# Don't store noisy/dumb items.
HISTIGNORE=" ?cd *":"e *":"sudo mv *":"sudo rm *":"sudo cp *":"sudo mkdir *":"sudo chmod *":"sudo chown *":"ls ?*":pwd:"vlc*"

# To these options assigned default value, as they satisfy my needs I comment them.
# HISTFILE=~/.bash_history  # where is command history stored
# HISTFILESIZE=500          # how many lines been in $HISTFILE
# HISTSIZE=500              # how many lines been stored in bash process

# Can be XXX /visible. I like bell.
# set bell-style visible

# Minor errors in the spelling of a directory component in a cd command will
# be corrected.
shopt -s cdspell

# Save all lines of a multiple-line command in the same history entry.
shopt -s cmdhist

# Allows files beginning with a dot ('.') to be returned in the results of path-name expansion.
shopt -s dotglob

# Adjust settings according to current terminal window width
# which may have changed while the last command was running
# (which is a common occurance for vim/less/etc.)
# Note this is already set in /etc/bashrc on Fedora 8 at least.
shopt -s checkwinsize

# Let me have core dumps
ulimit -c unlimited

################################################################
# shortcut aliases

alias ..="cd .."        #go to parent dir
alias ...="cd ../.."    #go to grandparent dir
alias -- -="cd -"       #go to previous dir
alias l.='ls -d .*'     #list hidden files
alias ll='ls -lhrt'     #extra info compared to "l"
alias lld='ls -lUd */'  #list directories

# make and change to a directory
md () { mkdir -p "$1" && cd "$1"; }

# GREP_COLOR=bright yellow on black bg.
# use GREP_COLOR=7 to highlight whitespace on black terminals
# LANG=C for speed. See also: http://www.pixelbeat.org/scripts/findrepo
# alias grep='GREP_COLOR="1;33;40" LANG=C grep --color=auto'

# alias ls="BLOCK_SIZE=\'1 ls --color=auto" #enable thousands grouping and colour
# alias minicom='minicom -c on' #enable colour
# alias cal='cal -3' #show 3 months by default
# alias units='units -t' #terse mode
# alias diff='LC_ALL=C TZ=GMT0 diff -Naur' #normalise diffs for distribution
# alias lynx='lynx -force_html -width=$COLUMNS' #best settings for viewing HTML
# alias links='links -force-html' #need to enable colour in config menu manually
# alias xterm='xterm -fb "" -bg black -fg gray -fa "Sans Mono" -fs 10 +sb -sl 3000 -g 80x50+1+1'
# alias sudo='sudo env PATH=$PATH' #work around sudo built --with-secure-path (ubuntu)
# alias vim='vim -X' #don't try to contact xserver (which can hang on network issues)
# alias gdb='gdb -tui' #enable the text window interface if possible

# what most people want from od (hexdump)
# alias hd='od -Ax -tx1z -v'

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"

# canonicalize path (including resolving symlinks)
# alias realpath='readlink -f'

# Use bash-completion, if available.
if [ -f /etc/bash_completion ]; then
  . /etc/bash_completion
fi
if [ -f $HOME/usr/etc/bash_completion ]; then
  . $HOME/usr/etc/bash_completion
fi

# Special case for CYGWIN to properly display russian letters in rxvt.
# Don't forget set in Windows SHELL=/bin/bash. If default SHELL is sh then .bashrc will not be read.
if [ -n "$COMSPEC" ]; then
  if [ x$OSTYPE = xcygwin ]; then
    export LANG=ru_RU.CP1251
  fi
fi