Created
May 5, 2016 17:51
-
-
Save pandemicsyn/1900379d99ae42714f78379c826a1709 to your computer and use it in GitHub Desktop.
.bashrc for "the" aio
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ~/.bashrc: executed by bash(1) for non-login shells. | |
# Note: PS1 and umask are already set in /etc/profile. You should not | |
# need this unless you want different defaults for root. | |
# PS1='${debian_chroot:+($debian_chroot)}\h:\w\$ ' | |
# umask 022 | |
# You may uncomment the following lines if you want `ls' to be colorized: | |
# export LS_OPTIONS='--color=auto' | |
# eval "`dircolors`" | |
# alias ls='ls $LS_OPTIONS' | |
# alias ll='ls $LS_OPTIONS -l' | |
# alias l='ls $LS_OPTIONS -lA' | |
# | |
# Some more alias to avoid making mistakes: | |
# alias rm='rm -i' | |
# alias cp='cp -i' | |
# alias mv='mv -i' | |
# Go stuff | |
export PATH=$PATH:/usr/local/go/bin | |
export GOPATH=/root/go | |
export PATH=$PATH:$GOPATH/bin | |
source /etc/bash_completion.d/git-prompt | |
function exitstatus { | |
EXITSTATUS="$?" | |
BOLD="\[\033[1m\]" | |
GREEN="\[\033[1;32m\]" | |
PRPL="\[\033[38;5;130m\]" | |
RED="\[\033[1;31m\]" | |
OFF="\[\033[m\]" | |
if [ "$EXITSTATUS" -eq "0" ]; then | |
PS1="\[\033[38;5;25m\]\u\[$(tput sgr0)\]\[\033[38;5;15m\]@\[$(tput sgr0)\]\[\033[38;5;125m\]\h\[$(tput sgr0)\]\[\033[38;5;15m\]:\[$(tput sgr0)\]\[\033[38;5;130m\]\W\[$(tput sgr0)\]\[\033[38;5;15m\]$(__git_ps1)\\$ \[$(tput sgr0)\]" | |
else | |
TMP="${USER}@${HOSTNAME%%.*}:${PWD##*/} $(__git_ps1)" | |
RPS1=`echo $TMP | python ~/.reverseit.py` | |
PS1="\n${PRPL} (╯°□°)╯ ${RED}$RPS1\$ ${OFF}" | |
echo -ne "\007" | |
fi | |
PS2="${BOLD}>${OFF} " | |
} | |
PROMPT_COMMAND=exitstatus | |
function gcd () { | |
cd ${HOME}/$@ | |
} | |
# go to a folder easily in your gopath | |
gogo(){ | |
local d=$1 | |
if [[ -z $d ]]; then | |
echo "You need to specify a project name." | |
return 1 | |
fi | |
if [[ "$d" = github* ]]; then | |
d=$(echo $d | sed 's/.*\///') | |
fi | |
d=${d%/} | |
# search for the project dir in the GOPATH | |
local path=( `find "${GOPATH}/src" \( -type d -o -type l \) -iname "$d" | awk '{print length, $0;}' | sort -n | awk '{print $2}'` ) | |
if [ "$path" == "" ] || [ "${path[*]}" == "" ]; then | |
echo "Could not find a directory named $d in $GOPATH" | |
echo "Maybe you need to 'go get' it ;)" | |
return 1 | |
fi | |
# enter the first path found | |
cd "${path[0]}" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment