Skip to content

Instantly share code, notes, and snippets.

@diegotf30
Last active March 27, 2022 14:12
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save diegotf30/c0acb32599e2641f73ec76a7d18d1e59 to your computer and use it in GitHub Desktop.
Save diegotf30/c0acb32599e2641f73ec76a7d18d1e59 to your computer and use it in GitHub Desktop.
# 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
# added by Anaconda3 installer
export PATH="/home/dtrevino/anaconda3/bin:$PATH"
# 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"
plugins=(
git
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}"
# 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"
# alias wakedesk="wakeonlan 00:c0:ca:97:b2:84"
# 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
source /usr/local/opt/enhancd/init.sh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment