Last active
June 20, 2024 13:02
-
-
Save acdesouza/1032318 to your computer and use it in GitHub Desktop.
Meu .bash_profile no MacOSX
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
export LC_CTYPE="utf-8" | |
export EDITOR=vim | |
# Turn terminal colors on | |
export CLICOLOR=1 | |
################################################################################ | |
# Bash PS1 | |
################################################################################ | |
# usuario@host:current_path | |
export PS1='\u@\h:\[\033[01;34m\]\w\[\033[00m\]' | |
# Mostrar o branch, do git, atual. Quando a pasta atual estiver no git. | |
export PS1=$PS1'$(__git_ps1 " \[\033[1;32m\](%s)\[\033[0m\]")' | |
# Mostrar o branch, do Mercurial, atual. Quando a pasta atual estiver no Hg. | |
#hg_branch() { | |
#hg branch 2> /dev/null | awk '{print "("$1")"}' | |
#} | |
#export PS1=$PS1' \[\033[1;32m\]$(hg_branch)\[\033[0m\]' | |
# Quebrar linha e colocar o $ . | |
export PS1=$PS1'\n\[\033[0;33m\]\$\[\033[0m\] ' | |
################################################################################ | |
################################################################################ | |
# Bash Completion | |
################################################################################ | |
if [ -f $(brew --prefix)/etc/bash_completion ]; then | |
. $(brew --prefix)/etc/bash_completion | |
fi | |
################################################################################ | |
################################################################################ | |
# Alias | |
################################################################################ | |
# Grep ignoring directories | |
alias grep="grep --color='auto'" | |
alias grep_project='grep -r --exclude-dir=.git --exclude-dir=.sass-cache --exclude-dir=coverage --exclude-dir=tmp --exclude-dir=log --exclude-dir=doc --exclude-dir=node_modules' | |
# Return current ip | |
alias myip="ifconfig | sed -En 's/127.0.0.1//;s/.*inet (addr:)?(([0-9]*\.){3}[0-9]*).*/\2/p'" | |
################################################################################ | |
################################################################################ | |
# Apps Configs | |
################################################################################ | |
# Homebrew | |
export PATH="/usr/local:/usr/local/bin:$PATH" | |
# Ruby on Rails 4.1 usar o bin do projeto primeiro. | |
export PATH="./bin:$PATH" | |
#------------------------------------------------------------------------------- | |
# Git | |
# http://technotales.wordpress.com/2009/05/17/git-diff-with-vimdiff/ | |
function git_diff() { | |
git diff --no-ext-diff -w "$@" | vim -R - | |
} | |
#------------------------------------------------------------------------------- | |
#------------------------------------------------------------------------------- | |
# tmux | |
# https://gist.github.com/todgru/6224848 | |
function tmux_rails() { | |
# Setup a work space using the current dir work` with two windows. | |
# Open one window to each common application: | |
# - rails server | |
# - rails console | |
# - git | |
# - nvim | |
# - bash | |
# - bash | |
session=${PWD##*/} | |
tmux has-session -t $session 2>/dev/null | |
SESSION_EXISTS=$? | |
# Create or attach to session with project name | |
tmux new-session -d -s $session -n 'git' | |
# Setup session only if it didn't exist | |
if [ $SESSION_EXISTS != 0 ]; then | |
# create windows: rails s, rails c, nvim, bash, bash called scratch | |
tmux new-window -a -n 'rails c' | |
tmux new-window -a -n 'rails s' | |
tmux new-window -a -n 'nvim' | |
tmux new-window -a -n 'bash' | |
tmux new-window -a -n 'bash' | |
tmux select-window -t $session:4 | |
tmux send-keys "nvim -S Session.vim" C-m | |
fi | |
tmux attach-session -t $session | |
} | |
#------------------------------------------------------------------------------- | |
# Sidekiq | |
INLINE_SIDEKIQ=true | |
# RVM | |
[[ -s "$HOME/.profile" ]] && source "$HOME/.profile" # Load the default .profile | |
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function* | |
[[ -r $rvm_path/scripts/completion ]] && . $rvm_path/scripts/completion | |
################################################################################ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment