Skip to content

Instantly share code, notes, and snippets.

@msimpson msimpson/.bashrc
Created Apr 12, 2016

Embed
What would you like to do?
Bash RC File
#
# .bashrc
#
# If not running interactively, don't do anything
[[ $- != *i* ]] && return
#
# Completion
#
. /usr/share/git/git-prompt.sh
#
# Prompt
#
if [[ $EUID -eq 0 ]]; then
PS1='\[\033[0;31m\][\[\033[0m\]\u\[\033[0;31m\]]\[\033[0m\] \[\033[0;31m\][\[\033[0m\]ruby-$(rvm-prompt s v)\[\033[0;31m\]]\[\033[0m\]$(__git_ps1 " \[\033[0;31m\][\[\033[0m\]%s\[\033[0;31m\]]\[\033[0m\]") \W\[\033[0;31m\]#\[\033[0m\] '
else
PS1='\[\033[0;32m\][\[\033[0m\]\u\[\033[0;32m\]]\[\033[0m\] \[\033[0;32m\][\[\033[0m\]ruby-$(rvm-prompt s v)\[\033[0;32m\]]\[\033[0m\]$(__git_ps1 " \[\033[0;32m\][\[\033[0m\]%s\[\033[0;32m\]]\[\033[0m\]") \W\[\033[0;32m\]$\[\033[0m\] '
fi
PS2='> '
PS3='> '
PS4='+ '
#
# Global exports
#
export GREP_COLOR='0;33'
export LESS_TERMCAP_mb=$'\033[1;37m'
export LESS_TERMCAP_md=$'\033[1;33m'
export LESS_TERMCAP_me=$'\033[0m'
export LESS_TERMCAP_se=$'\033[0m'
export LESS_TERMCAP_so=$'\033[1;37m'
export LESS_TERMCAP_ue=$'\033[0m'
export LESS_TERMCAP_us=$'\033[0;37m'
export LS_COLORS="di=0:fi=90:ln=90:pi=93:so=93:bd=93:cd=93:or=31:mi=31:ex=37"
export PATH=$PATH:/opt/java/jre/bin:/opt/flex-sdk/bin:/opt/android-sdk/platform-tools/:/opt/android-sdk/tools:$HOME/.rvm/bin:$HOME/.theme/bin:/opt/clojurescript/bin:$HOME/bin
export ANT_HOME='/usr/share/apache-ant'
export ANDROID_HOME='/opt/android-sdk'
export FLEX_PATH='/opt/flex-sdk/frameworks'
export FLEX_HOME='/opt/flex-sdk'
export WINEARCH='win64'
export WINEPREFIX='/home/msimpson/.wine'
export PYTHON=python2
export BROWSER=chromium
export TERM=rxvt
export EDITOR=vim
export VISUAL=vim
export PAGER=less
export HISTSIZE=5000
export SAVEHIST=5000
export HISTCONTROL=ignoredups
complete -cf sudo
shopt -s globstar
shopt -s cdspell
shopt -s extglob
shopt -s dotglob
# RVM
# Fix the Java non-refreshing window manager issue
# by impersonating Sun's own shitty window manager
export AWT_TOOLKIT=XToolkit
wmname LG3D
#
# Aliases
#
alias install=' packer -S'
alias remove=' sudo pacman -Rsn'
alias refresh=' sudo pacman -Syy'
alias update=' sudo pacman -Syu'
alias search=' sudo packer -Ss'
alias getpkg=' packer -G'
alias makepkg=' makepkg -s'
alias addpkg=' sudo pacman -U'
alias updatedb=' sudo updatedb'
alias systemctl=' sudo systemctl'
alias journalctl=' sudo journalctl'
alias q=' exit'
alias ..=' cd ..'
alias ...=' cd ../..'
alias open=' xdg-open'
alias mkx=' chmod a+x'
alias 755=' chmod 755'
alias 775=' chmod 775'
alias 777=' chmod 777'
alias ls=' ls --color=auto --group-directories-first'
alias ll=' ls -alh'
alias df=' df -h'
alias du=' du -h'
alias unix2dos=' dos2unix -D'
alias mkdir=' mkdir -p'
alias less=' less -r'
alias grep=' grep --color=auto'
alias egrep=' egrep --color=auto'
alias pgrep=' ps aux | grep'
alias hgrep=' history | grep'
alias free=' free -m'
alias ping=' ping -c 4'
alias vi=' vim'
alias top=' htop'
alias myip=' curl ifconfig.me'
alias git=' hub'
#
# Functions
#
function start(){ systemctl start "$1"; }
function stop(){ systemctl stop "$1"; }
function restart(){ systemctl restart "$1"; }
function status(){ systemctl status "$1"; }
function font-size(){
printf '\33]50;%s%d\007' "xft:DejaVu Sans Mono:pixelsize=" $1
}
function hdmi(){
if [[ "$1" == "on" ]]; then
xrandr --output eDP-1 --auto --output HDMI-1 --auto --right-of eDP-1
else
xrandr --output HDMI-1 --off
fi
}
function hdmi-mirror(){
if [[ "$1" == "on" ]]; then
xrandr --output eDP-0 --auto --output HDMI-0 --mode 1600x900
else
xrandr --output HDMI-0 --off
fi
}
colortest(){
local text=${1:-"gYw"}
echo -ne "\n "
echo -e "40m 41m 42m 43m 44m 45m 46m 47m"
for FGs in " m" " 1m" " 30m" "1;30m" " 31m" "1;31m" " 32m" \
"1;32m" " 33m" "1;33m" " 34m" "1;34m" " 35m" "1;35m" \
" 36m" "1;36m" " 37m" "1;37m"; do FG=${FGs// /}
echo -ne " $FGs \033[$FG $text "
for BG in 40m 41m 42m 43m 44m 45m 46m 47m
do echo -ne "$EINS \033[$FG\033[$BG $text \033[0m"
done
echo
done
echo
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.