eaf835581d1fb0f519b59dd05da416d7aa2c5de9
David Blume Fixed when /etc bashrc gets...

David Blume authored 8 years ago

1) if [[ $(uname -s) != Darwin* ]] && [ -f /etc/bashrc ]; then
2)     # Fedora but not Macintosh requires explicit sourcing of /etc/bashrc
3)     # On Debian, it's /etc/bash.bashrc, but it doesn't have to be sourced here.
4)     . /etc/bashrc
5) fi
6) 
David Blume Let the prompt show up to f...

David Blume authored 6 years ago

7) export PROMPT_DIRTRIM=4
David Blume New PS1 with error detectio...

David Blume authored 6 years ago

8) if [[ -n $SSH_CLIENT ]]; then
David Blume Use a green checkmark or re...

David Blume authored 6 years ago

9)     export PS1='$(if [ $? -eq 0 ]; then echo -e "\[\e[32m\]\xe2\x9c\x93"; else echo -e "\[\e[31m\]\xe2\x9c\x97"; fi) \[\e[38;5;242m\]\h:\w$\[\e[0m\] '
David Blume New PS1 with error detectio...

David Blume authored 6 years ago

10) else
David Blume Restore the PS1 for the non...

David Blume authored 4 years ago

11)     export PS1='$(if [ $? -eq 0 ]; then echo -e "\[\e[32m\]\xe2\x9c\x93"; else echo -e "\[\e[31m\]\xe2\x9c\x97"; fi) \[\e[38;5;242m\]\w$\[\e[0m\] '
David Blume New PS1 with error detectio...

David Blume authored 6 years ago

12) fi
13) 
14) set -o vi
David Blume first commit

David Blume authored 8 years ago

15) 
16) add_to_path() {
17)     if [ -d "$1" ] && [[ ! $PATH =~ (^|:)$1(:|$) ]]; then
18)         PATH+=:$1
19)     fi
20) }
21) 
22) # if this is a CygWin .bashrc, then set CygWin's commands first in PATH
23) # because link.exe and find.exe exist in Windows's path.
24) # Add /usr/lib/lapack at the end so python's numpy can find lapack_lite
25) # (Note: BSD bash, used by OS X doesn't have the "substr" test for expr.)
26) if [[ $(uname -s) == CYGWIN* ]]; then
David Blume Use spaces instead of tabs.

David Blume authored 8 years ago

27)     PATH=/usr/local/bin:/usr/bin:$PATH
28)     PATH=${PATH//":/usr/local/bin:/usr/bin"/} # delete any instances in middle
29)     add_to_path /usr/lib/lapack
David Blume Add md() support for Cygwin...

David Blume authored 5 years ago

30)     export GIT_SSH=/cygdrive/c/cygwin64/bin/ssh
David Blume Use spaces instead of tabs.

David Blume authored 8 years ago

31)     ulimit -n 1024 # for "duplicity"
David Blume first commit

David Blume authored 8 years ago

32) fi
33) 
David Blume whitespace

David Blume authored 6 years ago

34) # change the color of directories in the ls command
David Blume Refactor .bashrc to keep di...

David Blume authored 8 years ago

35) if [[ $(uname -s) == Darwin* ]]; then
36)     export LSCOLORS=gxfxcxdxbxegedabagacad
37)     export CLICOLOR=1
38) else
39)     # After executing: dircolors -p > .dircolors
40)     # Lighten the color of directories from blue to light blue
41)     # sed -i '/# directory/c\DIR 00;36 # directory' .dircolors
42)     if [ -x /usr/bin/dircolors ]; then
43)         test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
44)         alias ls='ls --color=auto'
45)     fi
David Blume first commit

David Blume authored 8 years ago

46) fi
47) 
David Blume Add .vimrc tab values for ....

David Blume authored 7 years ago

48) export P4DIFF='vim -d'  # Override from the command line: "P4DIFF=; p4 diff main.py"
David Blume Set vim as editor for cscope

David Blume authored 6 years ago

49) export CSCOPE_EDITOR=vim
David Blume Add .vimrc tab values for ....

David Blume authored 7 years ago

50) 
David Blume Add alias for colors in ls...

David Blume authored 8 years ago

51) alias grep='grep --color=auto'
52) alias fgrep='fgrep --color=auto'
53) alias egrep='egrep --color=auto'
David Blume I almost always want to do...

David Blume authored 4 years ago

54) alias vim-='vim +"setl buftype=nofile" -'
David Blume Add support for tmux; use p...

David Blume authored 3 years ago

55) alias tmux='tmux -2'
David Blume Add alias for colors in ls...

David Blume authored 8 years ago

56) 
57) # colored GCC warnings and errors
58) export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01'
59) 
David Blume first commit

David Blume authored 8 years ago

60) # Add to PATH only if not already in PATH.
61) add_to_path $HOME/bin
62) 
63) alias findinpyfiles="find . -name \*.py -print0 | xargs -0 grep -nI"
David Blume Add a few c++ aliases, and...

David Blume authored 8 years ago

64) alias findinchppfiles="find . -type f \( -name \*.[ch]pp -or -name \*.[ch] \) -print0 | xargs -0 grep -nI"
65) alias findincppfiles="find . -type f \( -name \*.cpp -or -name \*.c \) -print0 | xargs -0 grep -nI"
66) alias findinhppfiles="find . -type f \( -name \*.hpp -or -name \*.h \) -print0 | xargs -0 grep -nI"
67) 
68) alias clip="expand | cut -b1-\$COLUMNS"
David Blume Optionally source a .localr...

David Blume authored 7 years ago

69) 
David Blume Add alias for httpie https

David Blume authored 6 years ago

70) # For httpie: https://github.com/jakubroztocil/httpie#installation
71) alias https='http --default-scheme=https'
72) 
David Blume Add a command for viewing M...

David Blume authored 5 years ago

73) md() {
David Blume Make the local variables co...

David Blume authored 5 years ago

74)     declare -r sys_name=$(uname -s)
David Blume Add md() support for Cygwin...

David Blume authored 5 years ago

75)     if [[ $sys_name == Darwin* ]]; then
David Blume Make the local variables co...

David Blume authored 5 years ago

76)         declare -r T=$(mktemp $TMPDIR$(uuidgen).html)
David Blume Add md() support for Cygwin...

David Blume authored 5 years ago

77)         curl -s -X POST --data-binary @"$1" https://md.dlma.com/ > $T
David Blume No need to specify Safari t...

David Blume authored 5 years ago

78)         open $T
David Blume Add md() support for Cygwin...

David Blume authored 5 years ago

79)     elif [[ $sys_name == CYGWIN* ]]; then
David Blume Make the local variables co...

David Blume authored 5 years ago

80)         declare -r T=$(mktemp --suffix=.html)
David Blume Add md() support for Cygwin...

David Blume authored 5 years ago

81)         curl -s -X POST --data-binary @"$1" https://md.dlma.com/ > $T
82)         cygstart $T
David Blume Add a command for viewing M...

David Blume authored 5 years ago

83)     else
David Blume Make the local variables co...

David Blume authored 5 years ago

84)         declare -r T=$(mktemp --suffix=.html)
David Blume Add md() support for Cygwin...

David Blume authored 5 years ago

85)         curl -s -X POST --data-binary @"$1" https://md.dlma.com/ > $T
86)         xdg-open $T
David Blume On Linux systems, automatic...

David Blume authored 4 years ago

87)         echo "rm \"$T\" >/dev/null 2>&1" | at now + 2 minutes
David Blume Add a command for viewing M...

David Blume authored 5 years ago

88)     fi
89) }
90) 
David Blume I almost always want to do...

David Blume authored 4 years ago

91) concept() {
David Blume Add support for tmux; use p...

David Blume authored 3 years ago

92)     # apropos -s 7 . | awk '!/iso|latin/ {print $1}' | shuf -n 1 | xargs man 7
93)     apropos -s 7 . | awk '!/iso|latin/ {print $1}' | shuf -n 1 | pee "xargs echo man 7" "xargs man 7"
David Blume I almost always want to do...

David Blume authored 4 years ago

94) }
95) 
David Blume Moving ignoredups:erasedups...

David Blume authored 4 years ago

96) # https://unix.stackexchange.com/questions/1288/preserve-bash-history-in-multiple-terminal-windows
97) HISTCONTROL=ignoredups:erasedups
David Blume Add some commands to exclud...

David Blume authored 4 years ago

98) HISTIGNORE="&:ls:[bf]g:exit:pwd:clear"
David Blume I almost always want to do...

David Blume authored 4 years ago

99) #HISTFILESIZE=2000
100) #HISTSIZE=2000
101) # [ $(wc -l < $HOME/.bash_history) -gt 950 ] && echo "David, your .bash_history is over 950 lines. Consider updating your .bashrc."
David Blume Moving ignoredups:erasedups...

David Blume authored 4 years ago

102) shopt -s histappend
103) 
David Blume Forgot a corresponding chan...

David Blume authored 7 years ago

104) if [ -f $HOME/.localrc ]; then
David Blume Specify path for .localrc

David Blume authored 7 years ago

105)     source $HOME/.localrc