Skip to content

Instantly share code, notes, and snippets.

@mattvagni
Created March 13, 2019 18:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mattvagni/6e27bf5fdd2b57a74466f8f04be52dd3 to your computer and use it in GitHub Desktop.
Save mattvagni/6e27bf5fdd2b57a74466f8f04be52dd3 to your computer and use it in GitHub Desktop.
stuff
Theme:
https://marketplace.visualstudio.com/items?itemName=whizkydee.material-palenight-theme
#-------------------------------------------------------------------------------
# Make the default prompt with our custom colors
#-------------------------------------------------------------------------------
BLACK=$(tput setaf 0)
RED=$(tput setaf 1)
GREEN=$(tput setaf 2)
YELLOW=$(tput setaf 3)
BLUE=$(tput setaf 4)
MAGENTA=$(tput setaf 5)
CYAN=$(tput setaf 6)
WHITE=$(tput setaf 7)
BOLD=$(tput bold)
RESET=$(tput sgr0)
function git_branch () {
local git_status="$(git status 2> /dev/null)"
local on_branch="On branch ([^${IFS}]*)"
local on_commit="HEAD detached at ([^${IFS}]*)"
if [[ $git_status =~ $on_branch ]]; then
local branch=${BASH_REMATCH[1]}
echo " ($branch)"
elif [[ $git_status =~ $on_commit ]]; then
local commit=${BASH_REMATCH[1]}
echo " ($commit)"
fi
}
function git_branch_status () {
git diff --quiet --ignore-submodules HEAD &>/dev/null; [ $? -eq 1 ]&& echo -e "*"
}
PS1="\n\n\[\$BLUE\]\w\[$YELLOW\]\$(git_branch)\[$RED\]\$(git_branch_status)\n\[\$RESET\]$ "
#-------------------------------------------------------------------------------
# Autocompletion
# https://github.com/bobthecow/git-flow-completion/wiki/Install-Bash-git-completion
#-------------------------------------------------------------------------------
if [ -f `brew --prefix`/etc/bash_completion ]; then
. `brew --prefix`/etc/bash_completion
fi
if [ -f ~/.git-completion.bash ]; then
. ~/.git-completion.bash
fi
#-------------------------------------------------------------------------------
# Open PR
#-------------------------------------------------------------------------------
# Open pull request
function currepo() {
git config --get remote.origin.url | sed 's/.*@\(.*\)/\1/' | sed 's/\(.*\):\(.*\)/\1\/\2/' | sed 's/\(.*\)\.git/\1/';
}
function curbranch() {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/';
}
#-------------------------------------------------------------------------------
# Make sure history show timestamps.
#-------------------------------------------------------------------------------
export HISTTIMEFORMAT="%d.%m.%y %T "
#-------------------------------------------------------------------------------
# Aliases / Functions
#-------------------------------------------------------------------------------
alias ls="ls -1Gha"
alias c="clear"
alias gg="git grep --full-name --break --heading --line-number"
alias clean-branches="git branch --merged | grep -v '^* master$' | grep -v '^ master$' | xargs git branch -d"
alias openpr="open https://\`currepo\`/pull/new/\`curbranch\`"
alias refresh="source ~/.bash_profile"
function NUCLEAR_WAR() {
docker rm $(docker ps -a -q)
docker rmi $(docker images -q)
}
#-------------------------------------------------------------------------------
# Set the default editor
#-------------------------------------------------------------------------------
export EDITOR="code"
#-------------------------------------------------------------------------------
# Echo specific setup
#-------------------------------------------------------------------------------
alias gogo="cd ~/go/src/github.com/echo-health"
export PATH="$PATH:/Users/mathiasvagni/go/bin"
export GOPATH="/Users/mathiasvagni/go"
export PATH="$HOME/.fastlane/bin:$PATH"
eval "$(rbenv init -)"
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment