#!/usr/bin/env bash # ~/.bashrc # Made on kisho, fixed for use on SDF # xmpp:morus@yourdata.forsale # mailto:morus@sdf.org # Program envs-------------------------------------------------------- # if [[ -n ${SSH_CLIENT} ]] then BROWSER="w3m" elif command -v qutebrowser >/dev/null 2>&1 then BROWSER="qutebrowser" else BROWSER="xlinks2" fi export BROWSER # If not running interactively, stop here.---------------------------- # case $- in *i*) ;; *) return;; esac # Some globbing options----------------------------------------------- # shopt -s extglob # Extended globs are useful shopt -s failglob # Don't default to literal * if glob fails. shopt -s dotglob # Dotfiles are also human. # Prompts------------------------------------------------------------- # c=$(hostname | md5sum | tr 'a-z' '0-9' | cut -b 1) export PS1="\[\e[m\]\[\e[1;3${c}m\] \h\[\e[1;34m\] \w\[\e[0;${ec}m\] \$ " export PS2="^ " export PS4='$LINENO + ' export PROMPT_DIRTRIM=4 export PROMPT_COMMAND=( 'ec=$(( $? != 0 ? 31 : 29 ))' 'export PS1="${PS1%%\$*}\[\e[0;${ec}m\]\$\[\e[m\] "' ) # Colors-------------------------------------------------------------- # alias tree="tree -C" if command -v gls >/dev/null 2>&1 then alias gls="command gls --color=auto" else alias gls="command ls --color=auto" fi alias dir="dir --color=auto" alias vdir="vdir --color=auto" alias grep="grep --color=auto" alias fgrep="fgrep --color=auto" alias cgrep="grep --color=always" alias egrep="egrep --color=auto" alias diff="diff --color" alias xzdiff="xzdiff --color" alias bzdiff="bzdiff --color" export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01' # History file-------------------------------------------------------- # export HISTFILE="${XDG_STATE_HOME:-$HOME/.local/state}/bash_history" export HISTSIZE="-1" export HISTCONTROL="ignoreboth" shopt -s histappend shopt -s histverify shopt -s checkwinsize # man(1) settings----------------------------------------------------- # alias man='env MANWIDTH=$((COLUMNS > 80 ? 80 : COLUMNS)) man' alias less="env \ LESS_TERMCAP_md=$'\e[1;33m' \ LESS_TERMCAP_me=$'\e[0m' \ LESS_TERMCAP_us=$'\e[4;38;5;14m' \ LESS_TERMCAP_ue=$'\e[0m' \ less" # Query aliases------------------------------------------------------- # alias q="find . -maxdepth 1 | grep -i" alias Q="find . -maxdepth 1 | grep" alias h='< $HISTFILE sort | uniq | grep -i' alias H='< $HISTFILE sort | uniq | grep' alias g="grep -i" alias G="grep" # Other aliases------------------------------------------------------- # alias qq="exit" if command -v exa >/dev/null 2>&1 then alias ls='exa -h --group-directories-first --icons --time-style=long-iso' else alias ls="gls --human-readable --group-directories-first" fi alias ll="ls -l" alias la="ls -a" alias mi="micro" alias bo="bombadillo" alias quicknote='${EDITOR} ${HOME}/documents/quicknote.md' alias qn="quicknote" alias nohistory='export HISTFILE=/dev/null' # Some help for fancy stow packages------------------------------------# STOW_BASH_DIR="${XDG_CONFIG_HOME:-$HOME/.config}/bash"; if [ -d "${STOW_BASH_DIR}" ] then for f in "${STOW_BASH_DIR}"/*.sh do [ -f "${f}" ] && . "${f}" done fi