Created
March 23, 2012 01:46
-
-
Save hmalphettes/2166109 to your computer and use it in GitHub Desktop.
"my" ~/.bashrc: rvm and git prompt; ec2, esx, java mvn, tycho
This file contains 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. | |
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc) | |
# for examples | |
#git show branch and other things in the console | |
#http://henrik.nyh.se/2008/12/git-dirty-prompt | |
RED="\[\033[0;31m\]" | |
YELLOW="\[\033[0;33m\]" | |
GREEN="\[\033[0;32m\]" | |
BLUE="\[\033[0;34m\]" | |
LIGHT_RED="\[\033[1;31m\]" | |
LIGHT_GREEN="\[\033[1;32m\]" | |
WHITE="\[\033[1;37m\]" | |
LIGHT_GRAY="\[\033[0;37m\]" | |
COLOR_NONE="\[\e[0m\]" | |
function parse_git_branch { | |
git rev-parse --git-dir &> /dev/null | |
git_status="$(git status 2> /dev/null)" | |
branch_pattern="^# On branch ([^${IFS}]*)" | |
remote_pattern="# Your branch is (.*) of" | |
diverge_pattern="# Your branch and (.*) have diverged" | |
if [[ ! ${git_status} =~ "working directory clean" ]]; then | |
if [[ ${git_status} =~ "# Changes to commited" ]]; then | |
state="${RED}" | |
elif [[ ${git_status} =~ "# Changes not staged for commit" ]]; then | |
state="${RED}" | |
else | |
untracked="${LIGHT_RED}⚡" | |
state="${GREEN}" | |
fi | |
else | |
state="${GREEN}" | |
fi | |
# add an else if or two here if you want to get more specific | |
if [[ ${git_status} =~ ${remote_pattern} ]]; then | |
if [[ ${BASH_REMATCH[1]} == "ahead" ]]; then | |
remote="${YELLOW}↑" | |
else | |
remote="${YELLOW}↓" | |
fi | |
fi | |
if [[ ${git_status} =~ ${diverge_pattern} ]]; then | |
remote="${YELLOW}↕" | |
fi | |
if [[ ${git_status} =~ ${branch_pattern} ]]; then | |
branch=${BASH_REMATCH[1]} | |
echo "${state}(${branch})${remote}${untracked}" | |
fi | |
} | |
function rvm_prompt() { | |
$HOME/.rvm/bin/rvm-prompt v g | |
} | |
function prompt_func() { | |
previous_return_value=$?; | |
# prompt="${BLUE}[${COLOR_NONE} \w$(parse_git_branch)${BLUE}]${COLOR_NONE}" | |
# prompt="${LIGHT_GRAY}\w${COLOR_NONE}$(parse_git_branch)" | |
prompt="$(rvm_prompt):\w${COLOR_NONE}$(parse_git_branch)" | |
if test $previous_return_value -eq 0 | |
then | |
PS1="${prompt}${GREEN}\\\$${COLOR_NONE} " | |
else | |
PS1="${prompt}${LIGHT_RED}\\\$${COLOR_NONE} " | |
fi | |
} | |
PROMPT_COMMAND=prompt_func | |
# If not running interactively, don't do anything | |
[ -z "$PS1" ] && return | |
#################### (.......) | |
# AWS tools | |
export EC2_HOME=$HOME/apps/ec2-api-tools-1.5.2.4 | |
export EC2_AMITOOL_HOME=$HOME/apps/ec2-ami-tools-1.4.0.5 | |
export PATH=$PATH:$EC2_AMITOOL_HOME/bin:$EC2_HOME/bin | |
export EC2_PRIVATE_KEY=$HOME/.ec2/pk-intalio-XXXXXXXXXXXXXXXXXXXXXXXXXXXX.pem | |
export EC2_CERT=$HOME/.ec2/cert-intalio-XXXXXXXXXXXXXXXXXXXXXXXXXXXX.pem | |
export AWS_USERID="XXXXXXXXXXXXXXXXXXXXXXXXXXXX" | |
export AWS_ACCESSKEY="XXXXXXXXXXXXXXXXXXXXXXXXXXXX" | |
export AWS_SECRETKEY="XXXXXXXXXXXXXXXXXXXXXXXXXXXX" | |
export EC2_KEYPAIR_AP_SOUTHEAST_1="XXXXXXXXXXXXXXXXXXXXXXXXXXXX" | |
export EC2_KEYPAIR=$EC2_KEYPAIR_AP_SOUTHEAST_1 | |
export EC2_KEYPAIR_PEM=$HOME/.ec2/$EC2_KEYPAIR.pem | |
export EC2_REGION="ap-southeast-1" | |
export EC2_AVAILABILITY_ZONE="${EC2_REGION}b" | |
#XEN | |
#export VIRSH_DEFAULT_CONNECT_URI="xen:///" | |
export JAVA_HOME=/usr/lib/jvm/java-6-openjdk-amd64/ | |
export JAVA5_HOME=~/apps/jdk1.5.0_21 | |
alias mvn2=$HOME/apps/apache-maven-2.2.1/bin/mvn | |
alias mvn3=$HOME/apps/apache-maven-3.0/bin/mvn | |
alias mvn=$HOME/apps/apache-maven-3.0.3/bin/mvn | |
alias p2director=$HOME/apps/EclipseRTP2DirectorExtended-3.8.0.v20120122/p2director.sh | |
alias ant=$HOME/apps/apache-ant-1.8.1/bin/ant | |
alias node=$HOME/bin/node | |
export MAVEN3_HOME=$HOME/apps/apache-maven-3.0/ | |
export P2_RELEASE_HOME=$HOME/proj/neo/tycho-p2-scripts | |
export P2_DIRECTOR_HOME=$HOME/apps/EclipseRTP2DirectorExtended-3.7.0.v20110427 | |
[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" | |
[[ -r $rvm_path/scripts/completion ]] && . "$HOME/.rvm/scripts/completion" | |
export rvm_trust_rvmrcs_flag=1 # Trust all rmvrcs we find |
This file contains 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
# vi type of command | |
setw -g mode-keys vi | |
# scrolling with the mouse | |
set -g terminal-overrides 'xterm*:smcup@:rmcup@' |
This file contains 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
call pathogen#infect() | |
syntax on | |
filetype plugin indent on | |
" I like 2 spaces for indenting | |
set shiftwidth=2 | |
" I like 2 stops | |
set tabstop=2 | |
"do not keep a backup files | |
set nobackup | |
set nowritebackup |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment