# Check for an interactive session [ -z "$PS1" ] && return # Thanks rizlah, this function is awesome setup_prompt() { # Reset colour scheme local RST="\[\e[m\]" # Normal local NK="\[\e[0;30m\]" # Black local NR="\[\e[0;31m\]" # Red local NG="\[\e[0;32m\]" # Green local NY="\[\e[0;33m\]" # Yellow local NB="\[\e[0;34m\]" # Blue local NM="\[\e[0;35m\]" # Magenta local NC="\[\e[0;36m\]" # Cyan local NW="\[\e[0;37m\]" # White # Bold local BK="\[\e[1;30m\]" # Black local BR="\[\e[1;31m\]" # Red local BG="\[\e[1;32m\]" # Green local BY="\[\e[1;33m\]" # Yellow local BB="\[\e[1;34m\]" # Blue local BM="\[\e[1;35m\]" # Magenta local BC="\[\e[1;36m\]" # Cyan local BW="\[\e[1;37m\]" # White local BCB="\[\e[1;36;44m\]" if [ $UID -eq "0" ]; then local UC=$BR # Root PS1="${UC}#${RST} " else local UC=$BW # User PS1="${BCB}\$${RST} " fi #PS1="${UC}\u${RST}@${BCB}\h${RST}: ${NG}\w${RST} \\$ " PS2='> ' PS3='> ' PS4='+ ' } setup_prompt unset setup_prompt # Allow for users to have a personal /bin dir PATH="${PATH}:~/exe/script" alias ls='ls --color=auto --group-directories-first -h' alias sprunge='curl -F "sprunge=<-" http://sprunge.us' # alternate way to paste, if sprunge isn't capturing it all alias wgp='wgetpaste' alias tree='tree --dirsfirst' alias mkdir='mkdir -p' alias tsess="tmux a -t ${1}" # Useful for getting device info function devinfo() { udevadm info -a -p $(udevadm info -q path -n "${1}") } # Used to check the character map of a font. Needs xorg-xfd function utfcheck() { env XFT_DEBUG=1 xfd -fa ${1} } # Look for the specified text inside each file under a directory # Usage: # tgrep foo searches current directory (and below) for 'foo' # tgrep "fooba[rz] ./bar searches ./bar (and below) for 'foobar' or 'foobaz' alias tgrep='grep -rE "${@}"' # Protect users from themselves. Use 'i' instead of overloading the originals # so there aren't any surprises on a system that doesn't have these aliases alias ri='rm -i' alias ci='cp -i' alias mi='mv -i' alias sysupdate="emerge -avuDt --with-bdeps=y @world" # Change terminal font size in real-time. Doesn't work if you're inside # a terminal multiplexer, at least for now. # TODO: Figure out a way to abstract this to a script that: # * Finds the currently focused terminal window # * determines whether or not tmux is active and, if so, detaches # * runs the escape inside said terminal (preserving xclipboard if # needed) # * echos "Success!" and returns to tmux function tfont() { case $1 in [bB]) _font="Droid Sans Mono Slashed-22" ;; [mM]) _font="Droid Sans Mono Slashed-16" ;; [sS]) _font="Sporx-10" ;; *) _font="$1" ;; esac if [[ $TMUX ]]; then echo "Detach your session first! This won't work over SSH, either." return fi echo -en "\033]710;xft:${_font}\033\\" echo "Font changed!" }