dot rc

Sign in or create your account | Project List | Help

dot rc Git Source Tree

Root/rc/bashrci

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

Archive Download this file

Branches:
master