123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164 |
- ##### My (demuredemeanor) bashrc sub source export script
- # Uses tabstop=4; shiftwidth=4 tabs; foldmarker={{{,}}};
- # https://notabug.org/demure/dotfiles/
- # legacy repo http://github.com/demure/dotfiles
- # vim:set syntax=sh:
- ### Bash Exports ### {{{
- export CLICOLOR="YES" ## Color 'ls', etc.
- export EDITOR=vim ## Set default editor
- export BROWSER=chromium
- export BROWSERCLI=w3m
- ## Adding PATH junk
- if [ ! -e "${HOME}/.no_path" ]; then
- 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:${HOME}/go/bin:/usr/local/games:/usr/games
- fi
- ### History Settings ### {{{
- export HISTSIZE=100000 ## Size of shells hist
- export HISTFILESIZE=100000 ## Size of Hist file
- export HISTCONTROL=ignoreboth:erasedups
- export HISTTIMEFORMAT="%F %T " ## Adds time to history
- export HISTIGNORE='ls:bg:fg:history' ## Hist ignores exact match
- ### End History Settings ### }}}
- ### End Bash Exports ### }}}
- ### SSH Agents ### {{{
- if [ ! -e "${HOME}/.no_agent" ]; then
- if [ -s "${HOME}/.ssh/id_ed25519" ] || [ -s "${HOME}/.ssh/id_rsa" ]; then
- ## If there is a ssh key, load key for ssh
- __ssh_agent
- else
- if [ "$(gpg -K 2>/dev/null | awk 'BEGIN {AK=0} /^ssb>?\s/ {if($4=="[A]"){AK=1}} END {print AK}')" -eq 1 ]; then
- ## If no ssh key, and if there is a gpg auth key, load gpg key for ssh
- __ssh_gpg_agent
- fi
- fi
- fi
- ### End SSH Agents ### }}}
- ### Grep Options ### {{{
- ## So, this code is because even though GREP_OPTIONS are 'dead',
- ## some servers still have older than grep 2.20...
- ## I'm using awk, as bash doesn't really do decimal
- 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"}}')"
- if [ ${grep_test} == "ge" ]; then
- ## If new, do it the way grep says to
- alias grep='grep --color=auto --exclude-dir=.cvs --exclude-dir=.git --exclude-dir=.hg --exclude-dir=.svn'
- else
- ## If old, use GREP_OPTIONS, as --exclude may not exist, and annoying errors!
- if echo hello | grep --color=auto l >/dev/null 2>&1; then
- GREP_OPTIONS+="--color=auto " GREP_COLOR='1;31'
- fi
- if echo hello | grep --exclude-dir=a l >/dev/null 2>&1; then
- for PATTERN in .cvs .git .hg .svn; do
- GREP_OPTIONS+="--exclude-dir=$PATTERN "
- done
- fi
- export GREP_OPTIONS
- fi
- ### End Grep Options ### }}}
- ### z Jump Around ### {{{
- if [ ${UID} != '0' ] && [[ $- == *i* ]] && [ ${TERM} != 'dumb' ]; then
- if [ $(command -v z.sh) ]; then
- ## debian
- source $(command -v z.sh)
- elif [ -r "/usr/share/z/z.sh" ]; then
- ## arch
- source /usr/share/z/z.sh
- else
- MISSING_ITEMS+="z_jump, "
- fi
- fi
- ### End z Jump Around ### }}}
- ### MOTD Stuff ### {{{
- ### Fortune At Login ### {{{
- ## Tests for fortune, root, interactive shell, and dumb term
- if [ $(command -v fortune) ] && [ ${UID} != '0' ] && [[ $- == *i* ]] && [ ${TERM} != 'dumb' ]; then
- fortune -a
- else
- MISSING_ITEMS+="fortune, "
- fi
- ### End Fortune ### }}}
- ### Memo At Login ### {{{
- ## Tests for memo, root, interactive shell, and dumb term
- # http://www.getmemo.org/index.html
- if [ $(command -v memo) ] && [ ${UID} != '0' ] && [[ $- == *i* ]] && [ ${TERM} != 'dumb' ]; then
- ## If it has been four or more hours, show.
- if [ -e ${HOME}/.memo ] && [ "$(date +%s)" -ge "$(echo $(stat --printf=%Y ${HOME}/.memo) + 14400 | bc)" ]; then
- memo -u 2>/dev/null
- touch ${HOME}/.memo
- fi
- else
- MISSING_ITEMS+="memo, "
- fi
- ### End Memo ### }}}
- ### Taskwarrior At Login ### {{{
- ## Tests for task, root, interactive shell, and dumb term
- # http://taskwarrior.org/
- if [ $(command -v task) ] && [ ${UID} != '0' ] && [[ $- == *i* ]] && [ ${TERM} != 'dumb' ]; then
- ## Don't try to show if term is too small
- if [ $(tput cols) -ge 90 ]; then
- ## If it has been four or more hours, show.
- if [ -e ${HOME}/.task/pending.data ] && [ "$(date +%s)" -ge "$(echo $(stat --printf=%Y ${HOME}/.task/pending.data) + 14400 | bc)" ]; then
- task limit:5 2>/dev/null
- touch ${HOME}/.task/pending.data
- fi
- fi
- else
- MISSING_ITEMS+="taskwarrior, "
- fi
- ### End Taskwarrior ### }}}
- ### End MOTD Stuff ### }}}
- ### Game Confs ### {{{
- ### Nethack Conf ### {{{
- if [ -f ${HOME}/.nethackrc ]; then
- export NETHACKOPTIONS=~/.nethackrc
- else
- MISSING_ITEMS+="nethackrc, "
- fi
- ### End Nethack ### }}}
- ### Slash'em Conf ### {{{
- if [ -f ${HOME}/.slashemrc ]; then
- export SLASHEMOPTIONS=~/.slashemrc
- else
- MISSING_ITEMS+="slashemrc, "
- fi
- ### End Slash'em ### }}}
- ### End Game Confs ### }}}
- ### Figlet Fonts ### {{{
- if [ -d "${HOME}/.config/figfonts" ]; then
- export FIGLET_FONTDIR="${HOME}/.config/figfonts"
- fi
- ### End Figlet Fonts ### }}}
- ### Ensure Unicode ### {{{
- if [ -z "${LANG}" ]; then
- export LANG="en_US.UTF-8"
- fi
- if [ -z "${LANGUAGE}" ]; then
- export LANGUAGE="en_US.UTF-8"
- fi
- ### Ensure Unicode ### }}}
- ## This section is here for reminding people why you shouldn't force the TERM
- # ### TERM color ### {{{
- # ## Disabled, as forcing is kind of bad >_>
- # ## http://blog.sanctum.geek.nz/term-strings/
- # if [ -e /usr/share/terminfo/x/xterm-256color ]; then
- # export TERM='xterm-256color'
- # else
- # export TERM='xterm-color'
- # fi
- # ### End TERM ### }}}
|