Skip to content

Instantly share code, notes, and snippets.

@diegotf30
Last active May 19, 2026 02:00
Show Gist options
  • Select an option

  • Save diegotf30/c0acb32599e2641f73ec76a7d18d1e59 to your computer and use it in GitHub Desktop.

Select an option

Save diegotf30/c0acb32599e2641f73ec76a7d18d1e59 to your computer and use it in GitHub Desktop.
# Setup steps:
# - Pre-requisites: homebrew, npm, git
# /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
# curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.4/install.sh | bash
# - Install theme purer (https://github.com/DFurnes/purer)
# sudo npm install --global purer-prompt
# - Install plugin enhancd (https://github.com/babarot/enhancd)
# git clone https://github.com/babarot/enhancd.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/enhancd
# - Install plugin zsh-syntax-highlighting
# git clone https://github.com/zsh-users/zsh-syntax-highlighting ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
# - Install plugin zsh-autosuggestions
# git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
# - Install fzf
# brew install fzf
# Setup theme
autoload -U promptinit; promptinit
prompt purer
WORDCHARS='*?_-.[]~=&;!#$%^(){}<>'
# If you come from bash you might have to change your $PATH.
# export PATH=$HOME/bin:/usr/local/bin:$PATH
# Path to your oh-my-zsh installation.
export ZSH=$HOME/.oh-my-zsh
# CMAKE
export CC=/usr/bin/gcc
export CXX=/usr/bin/g++
# Theme options
export PURE_PROMPT_PATH_FORMATTING=%(5~|%-1~/…/%3~|%4~)
# Enancd
export FZF_DEFAULT_OPTS="--height 20% --border"
export ENHANCD_FILTER="fzf"
# Ruby
export PATH="/usr/local/opt/ruby/bin:$PATH"
export PATH="$(gem env home)/bin:$PATH"
plugins=(
git
rails
ruby
enhancd
zsh-autosuggestions
zsh-syntax-highlighting
)
#### ALIASES ####
alias desk="cd ~/Desktop/"
alias down="cd ~/Downloads/"
alias dl="down"
alias docs="cd ~/Documents/"
alias count="ls -1 | wc -l"
alias vlc="/Applications/VLC.app/Contents/MacOS/VLC"
# Git Utils
alias newmt="git branch -D master && git checkout -b master && git branch --set-upstream-to=origin/master master"
alias mt="git checkout master"
alias diff="git diff origin/master"
alias st="git status"
alias branch="git log --all --decorate --oneline --graph" #Pretty branch display
alias br="branch"
alias r-br="git fetch > /dev/null && watch -n5 --color git log --all --decorate --oneline --graph --color=always" #Pretty branch auto-updating every 5s
alias r-st="watch -n5 --color git status"
alias curr="git symbolic-ref HEAD --short" #Current branch name
## Actions
alias add="git add . && git status"
alias amend="git commit --amend --no-edit"
alias push="git push --set-upstream origin \$(curr)"
alias fpush="git push origin \$(curr) -f" # Force push on curr-branch
alias stash="git stash"
alias commit="git commit"
## Branch mgmt
alias ftch="git fetch"
alias ft=ftch
alias pull="git pull origin \$(curr)"
alias chk="git checkout"
alias reset="git reset HEAD"
alias hreset="git reset --hard @{u}"
# Rails
db() { rails db:"$*" }
alias rspec="bundle exec rspec"
alias r="rails"
alias c="rails c"
alias dbm="rails db:migrate"
alias dbroll="rails db:rollback STEP=1"
alias dbreset="rails db:migrate && rails db:reset"
alias dbr="dbreset"
# Python
alias jupyter="~/opt/anaconda3/bin/jupyter_mac.command"
## Python 3
alias pip='python3 -m pip'
alias pip3=pip
alias py='python3'
alias py3=py
## Python 2
alias py2='python'
alias pip2='pip'
# Postgres
alias psql="psql -h localhost -U postgres"
# Wake on LAN
# alias wakedesk="wakeonlan 04:d4:c4:58:8a:5f"
# Pretty ls colors
eval $(dircolors -b $HOME/.LS_COLORS)
# Functions
function mkcd() {
mkdir $1 && cd $1
}
function git-lines() {
local AUTHOR="diegotf30"
if [ "$1" != "" ]
then
AUTHOR=$1
fi
git log --shortstat --author "$AUTHOR" $2 \
| grep "files\? changed" \
| awk '{files+=$1; inserted+=$4; deleted+=$6} END \
{print "files changed", files, "lines inserted:", inserted, "lines deleted:", deleted}'
}
source $ZSH/oh-my-zsh.sh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment