Put the following into ~/.bash_profile:
# Do not clean the screen when man exits. Search case-insensitively.
# Read the man page of man to know what environment variable to set.
# It's either PAGER or MANPAGER.
export PAGER="/usr/bin/less -iRsX"
# Or you may change the global option for less, assuming man uses less by default:
export LESS="-iRsX"
# Make Bash append rather than overwrite the history on disk:
shopt -s histappend
# Whenever displaying the prompt, write the previous line to disk:
PROMPT_COMMAND='history -a'
# Colorful grep, see http://www.debian-administration.org/articles/460
# 'always' is more dangerous than 'auto', 'coz it sends control characters all the way down the pipe (if any)
export GREP_OPTIONS='--color=always'
# Use vim as a syntax-highlighting pager, see ":help less"