# vim:filetype=sh # .bashrc for interactive shells # enable some shell options while read opt comment; do [ -n "$opt" -a "$opt" != . ] && shopt -s $opt done <<\EOF cdspell correct minor errors in the spelling of a directory . component in a 'cd' command checkhash check if hashed command path exists before executing . the command, refresh if needed checkwinsize check window size after each command, update LINES and COLUMNS cmdhist save all lines of a multiple-line command in the same history . entry extglob use extended pattern matching rules ?,*,+,@,!() histreedit allow re-edition of failed history substitution huponexit send SIGHUP to all jobs when login shell exits no_empty_cmd_completion don't try to autocomplete on an empty line promptvars prompt strings undergo normal expansion EOF # disable some shell options while read opt comment; do [ -n "$opt" -a "$opt" != . ] && shopt -u $opt done <<\EOF hostcomplete don't try to complete hostnames for words containing a @ nullglob don't expand to nothing if pattern fails to match any filename failglob don't error if pattern fails to match any filename EOF # want this: #sourcepath don't use PATH for "source" (".") set -P # use physical directory instead of symlink, in cd/pushd/... ## history shopt -s histappend HISTFILE=~/.bash_history HISTFILESIZE=8000 HISTSIZE=2000 # add :ignorespace to ignore lines beginning with whitespace HISTCONTROL=erasedups HISTTIMEFORMAT="%F %T -- " ## vim alias ## gvim if DISPLAY set and to localhost _check_gvim() { # if DISPLAY set, check if it isn't a remote DISPLAY if [ -n "$DISPLAY" ]; then _check_if_remote_display return $? fi # OS X: gvim uses cocoa [ $(uname -s) = Darwin ] # failed otherwise } if _exists gvim && _check_gvim; then alias vi=mvim alias vim=mvim elif _exists vim; then alias vi=svim alias vim=svim [ -n "$DISPLAY" ] && _exists gvim || alias gvim=svim else alias vim=vi alias gvim=vi fi ## remove temporary function unset _check_gvim ## less alias if _exists less; then alias more=less else alias less=more fi