export 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. ##### My (demuredemeanor) bashrc sub source export script
  2. # Uses tabstop=4; shiftwidth=4 tabs; foldmarker={{{,}}};
  3. # https://notabug.org/demure/dotfiles/
  4. # legacy repo http://github.com/demure/dotfiles
  5. # vim:set syntax=sh:
  6. ### Bash Exports ### {{{
  7. export CLICOLOR="YES" ## Color 'ls', etc.
  8. export EDITOR=vim ## Set default editor
  9. export BROWSER=qutebrowser
  10. export BROWSERCLI=w3m
  11. ## Adding PATH junk
  12. export PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/pkg/bin:/usr/local/bin:/usr/local/sbin:${HOME}/projects/personal/scripts:${HOME}/bin:${HOME}/.local/bin:/usr/local/games:/usr/games
  13. ### History Settings ### {{{
  14. export HISTSIZE=100000 ## Size of shells hist
  15. export HISTFILESIZE=100000 ## Size of Hist file
  16. export HISTCONTROL=ignoreboth:erasedups
  17. export HISTTIMEFORMAT="%F %T " ## Adds time to history
  18. export HISTIGNORE='ls:bg:fg:history' ## Hist ignores exact match
  19. ### End History Settings ### }}}
  20. ### End Bash Exports ### }}}
  21. ### Fortune At Login ### {{{
  22. ## Tests for fortune, root, interactive shell, and dumb term
  23. if [ $(command -v fortune) ] && [ ${UID} != '0' ] && [[ $- == *i* ]] && [ ${TERM} != 'dumb' ]; then
  24. fortune -a
  25. else
  26. MISSING_ITEMS+="fortune, "
  27. fi
  28. ### End Fortune ### }}}
  29. ### Memo At Login ### {{{
  30. ## Tests for memo, root, interactive shell, and dumb term
  31. # http://www.getmemo.org/index.html
  32. if [ $(command -v memo) ] && [ ${UID} != '0' ] && [[ $- == *i* ]] && [ ${TERM} != 'dumb' ]; then
  33. ## If it has been four or more hours, show.
  34. if [ -e ${HOME}/.memo ] && [ "$(date +%s)" -ge "$(echo $(stat --printf=%Y ${HOME}/.memo) + 14400 | bc)" ]; then
  35. memo -u 2>/dev/null
  36. touch ${HOME}/.memo
  37. fi
  38. else
  39. MISSING_ITEMS+="memo, "
  40. fi
  41. ### End Memo ### }}}
  42. ### Taskwarrior At Login ### {{{
  43. ## Tests for task, root, interactive shell, and dumb term
  44. # http://taskwarrior.org/
  45. if [ $(command -v task) ] && [ ${UID} != '0' ] && [[ $- == *i* ]] && [ ${TERM} != 'dumb' ]; then
  46. ## Don't try to show if term is too small
  47. if [ $(tput cols) -ge 90 ]; then
  48. ## If it has been four or more hours, show.
  49. if [ -e ${HOME}/.task/pending.data ] && [ "$(date +%s)" -ge "$(echo $(stat --printf=%Y ${HOME}/.task/pending.data) + 14400 | bc)" ]; then
  50. task limit:5 2>/dev/null
  51. touch ${HOME}/.task/pending.data
  52. fi
  53. fi
  54. else
  55. MISSING_ITEMS+="taskwarrior, "
  56. fi
  57. ### End Taskwarrior ### }}}
  58. ### Grep Options ### {{{
  59. ## So, this code is because even though GREP_OPTIONS are 'dead',
  60. ## some servers still have older than grep 2.20...
  61. ## I'm using awk, as bash doesn't really do decimal
  62. grep_test="$(grep --version 2>/dev/null | awk 'BEGIN {VER=0; CUT=2.20} /^grep/ NR>1{if($NF!~/[a-z]/){VER=$NF}} END {if(VER<CUT){print "lt"} else {print "ge"}}')"
  63. if [ ${grep_test} == "ge" ]; then
  64. ## If new, do it the way grep says to
  65. alias grep='grep --color=auto --exclude-dir=.cvs --exclude-dir=.git --exclude-dir=.hg --exclude-dir=.svn'
  66. else
  67. ## If old, use GREP_OPTIONS, as --exclude may not exist, and annoying errors!
  68. if echo hello | grep --color=auto l >/dev/null 2>&1; then
  69. GREP_OPTIONS+="--color=auto " GREP_COLOR='1;31'
  70. fi
  71. if echo hello | grep --exclude-dir=a l >/dev/null 2>&1; then
  72. for PATTERN in .cvs .git .hg .svn; do
  73. GREP_OPTIONS+="--exclude-dir=$PATTERN "
  74. done
  75. fi
  76. export GREP_OPTIONS
  77. fi
  78. ### End Grep Options ### }}}
  79. ### Nethack Conf ### {{{
  80. if [ -f ${HOME}/.nethackrc ]; then
  81. export NETHACKOPTIONS=~/.nethackrc
  82. else
  83. MISSING_ITEMS+="nethackrc, "
  84. fi
  85. ### End Nethack ### }}}
  86. ### Slash'em Conf ### {{{
  87. if [ -f ${HOME}/.slashemrc ]; then
  88. export SLASHEMOPTIONS=~/.slashemrc
  89. else
  90. MISSING_ITEMS+="slashemrc, "
  91. fi
  92. ### End Slash'em ### }}}
  93. # ### TERM color ### {{{
  94. # ## Disabled, as forcing is kind of bad >_>
  95. # ## http://blog.sanctum.geek.nz/term-strings/
  96. # if [ -e /usr/share/terminfo/x/xterm-256color ]; then
  97. # export TERM='xterm-256color'
  98. # else
  99. # export TERM='xterm-color'
  100. # fi
  101. # ### End TERM ### }}}