Skip to content

Instantly share code, notes, and snippets.

@jkubicek
Last active May 24, 2016 23:02
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 jkubicek/5155766 to your computer and use it in GitHub Desktop.
Save jkubicek/5155766 to your computer and use it in GitHub Desktop.
my .bash_profile
#!/bin/bash
# Functions to change tab and window names in Terminal
function tabname {
if [ -z $1 ]
then
printf "\e]1;${PWD##*/}\a"
else
printf "\e]1;$1\a"
fi
}
function winname {
printf "\e]2;$1\a"
}
PATH=$HOME/bin:$PATH
# Allow the use of '!' in strings
# http://serverfault.com/a/208414
set +H
# Load our git commands
source $(brew --prefix)/etc/bash_completion.d/git-prompt.sh
source $(brew --prefix)/etc/bash_completion.d/git-completion.bash
# Create our custom prompt
export GIT_PS1_SHOWDIRTYSTATE=1
export GIT_PS1_SHOWSTASHSTATE=1
export GIT_PS1_SHOWUNTRACKEDFILES=1
export GIT_PS1_SHOWUPSTREAM="auto"
PS1='\[\e[1;32m\]$(__git_ps1 " (%s)")\[\e[m\]'
PS1="
\[\e[1;36m\]\w\[\e[m\]$PS1\[\e[1;36m\]
👁 \[\e[m\]"
export PS1
alias rlb='source ~/.bash_profile'
# Use up and down arrows to navigate filtered history
bind '"\e[A":history-search-backward'
bind '"\e[B":history-search-forward'
# Case insensitive autocomplete
bind "set completion-ignore-case on"
bind "set show-all-if-ambiguous on"
# Environment variables
export VISUAL=vim
export EDITOR="$VISUAL"
export CLICOLOR=1
export XCODE="`xcode-select --print-path`"
# Git related aliases
alias g='git'
alias gc='git commit -m '
alias gca='git commit --amend --no-edit'
alias gac='git commit --all -m '
alias ga='git add --all .'
alias gl='git log --oneline --graph'
alias gd='clear && git diff'
alias gdc='clear && git diff --cached'
alias gp='git push −−recurse−submodules=check'
alias gt='git difftool'
alias gs='git status'
alias ts='tig status'
alias gu='git-up'
alias gup='git-up && git push'
alias gsu='git submodule update --recursive --init'
alias gho="git config --get remote.origin.url | sed 's#^[^:]*.\([^.]*\)\.\(wiki\)*\(.\)*git#http://github.com/\1/\2#' | xargs open"
alias ghof="/usr/local/bin/git-open-curr-in-github"
# Autocomplete for 'g' as well
complete -o default -o nospace -F _git g
# Other aliases
alias ls='ls -lFGh'
alias up='cd ..;ls'
alias h='history | grep '
alias f='mdfind -onlyin ./ '
alias xo='/bin/ls | grep -e ".xc[odeproj|workspace]" | sort --reverse | head -n 1 | xargs open'
alias server='python -m http.server'
alias server80='sudo python -m http.server 80'
alias alert='tput bel'
# Add Fast git autocomplete
complete -o default -W "\$(git branch 2>/dev/null | cut -c 3-)" git
# Open a man page in Preview.app
pman () { man -t "${1}" | open -f -a /Applications/Preview.app; }
# iTunes
alias play="osascript -e 'tell application \"iTunes\" to play'"
alias pause="osascript -e 'tell application \"iTunes\" to pause'"
# Terminal
alias terminal="osascript -e 'tell application \"Terminal\" to activate'"
# Setup z
. `brew --prefix`/etc/profile.d/z.sh
# Quick way to rebuild the Launch Services database and get rid
# of duplicates in the Open With submenu.
alias fixopenwith='/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister -kill -r -domain local -domain system -domain user'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment