Root/
| Source at commit b9861e0f76d6be15da1e8ac114c545c20c389d7b created 2 years 3 days ago. By Luciano Rocha, OS X fixes | |
|---|---|
| 1 | # vim:filetype=sh |
| 2 | # .bashrc for interactive shells |
| 3 | |
| 4 | # enable some shell options |
| 5 | while read opt comment; do |
| 6 | [ -n "$opt" -a "$opt" != . ] && shopt -s $opt |
| 7 | done <<\EOF |
| 8 | cdspell correct minor errors in the spelling of a directory |
| 9 | . component in a 'cd' command |
| 10 | checkhash check if hashed command path exists before executing |
| 11 | . the command, refresh if needed |
| 12 | checkwinsize check window size after each command, update LINES and COLUMNS |
| 13 | cmdhist save all lines of a multiple-line command in the same history |
| 14 | . entry |
| 15 | extglob use extended pattern matching rules ?,*,+,@,!() |
| 16 | histreedit allow re-edition of failed history substitution |
| 17 | huponexit send SIGHUP to all jobs when login shell exits |
| 18 | no_empty_cmd_completion don't try to autocomplete on an empty line |
| 19 | promptvars prompt strings undergo normal expansion |
| 20 | EOF |
| 21 | |
| 22 | # disable some shell options |
| 23 | while read opt comment; do |
| 24 | [ -n "$opt" -a "$opt" != . ] && shopt -u $opt |
| 25 | done <<\EOF |
| 26 | hostcomplete don't try to complete hostnames for words containing a @ |
| 27 | sourcepath don't use PATH for "source" (".") |
| 28 | nullglob don't expand to nothing if pattern fails to match any filename |
| 29 | failglob don't error if pattern fails to match any filename |
| 30 | EOF |
| 31 | |
| 32 | set -P # use physical directory instead of symlink, in cd/pushd/... |
| 33 | |
| 34 | ## history |
| 35 | shopt -s histappend |
| 36 | HISTFILE=~/.bash_history |
| 37 | HISTFILESIZE=8000 |
| 38 | HISTSIZE=2000 |
| 39 | # add :ignorespace to ignore lines beginning with whitespace |
| 40 | HISTCONTROL=erasedups |
| 41 | HISTTIMEFORMAT="%F %T -- " |
| 42 | |
| 43 | ## vim alias |
| 44 | ## gvim if DISPLAY set and to localhost |
| 45 | _check_gvim() |
| 46 | { |
| 47 | # if DISPLAY set, check if it isn't a remote DISPLAY |
| 48 | if [ -n "$DISPLAY" ]; then |
| 49 | _check_if_remote_display |
| 50 | return $? |
| 51 | fi |
| 52 | |
| 53 | # OS X: gvim uses cocoa |
| 54 | [ $(uname -s) = Darwin ] |
| 55 | |
| 56 | # failed otherwise |
| 57 | } |
| 58 | |
| 59 | if _exists gvim && _check_gvim; then |
| 60 | alias vi=mvim |
| 61 | alias vim=mvim |
| 62 | elif _exists vim; then |
| 63 | alias vi=svim |
| 64 | alias vim=svim |
| 65 | [ -n "$DISPLAY" ] && _exists gvim || alias gvim=svim |
| 66 | else |
| 67 | alias vim=vi |
| 68 | alias gvim=vi |
| 69 | fi |
| 70 | |
| 71 | ## remove temporary function |
| 72 | unset _check_gvim |
| 73 | |
| 74 | ## less alias |
| 75 | if _exists less; then |
| 76 | alias more=less |
| 77 | else |
| 78 | alias less=more |
| 79 | fi |
| 80 | |
