Skip to content

Instantly share code, notes, and snippets.

@iamsarthakjoshi
Forked from karlhadwen/.zshrc
Created September 2, 2020 16:53
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 iamsarthakjoshi/bc18e496b843049309566b8d6de3749a to your computer and use it in GitHub Desktop.
Save iamsarthakjoshi/bc18e496b843049309566b8d6de3749a to your computer and use it in GitHub Desktop.
.zshrc settings
export ZSH="/Users/karl/.oh-my-zsh"
export PATH=${PATH}:/usr/local/mysql/bin/
ZSH_THEME="robbyrussell"
plugins=(
git
osx
zsh-autosuggestions
last-working-dir
)
source $ZSH/oh-my-zsh.sh
source /Users/karl/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
# configuration
# custom aliases
alias f='open -a Finder';
alias c="code .";
alias ll="ls -1a";
alias ..="cd ../";
alias ..l="cd ../ && ll";
alias pg="echo 'Pinging Google' && ping www.google.com";
alias de="cd ~/Desktop";
alias dd="cd ~/code";
alias d="cd ~/code && cd ";
alias show-files='defaults write com.apple.finder AppleShowAllFiles YES; killall Finder /System/Library/CoreServices/Finder.app';
alias hide-files='defaults write com.apple.finder AppleShowAllFiles NO; killall Finder /System/Library/CoreServices/Finder.app';
alias delete-dsfiles="find . -name '.DS_Store' -type f -delete";
alias npm-update="npx npm-check -u";
alias flushdns="sudo dscacheutil -flushcache;sudo killall -HUP mDNSResponder";
alias cleandesk="defaults write com.apple.finder CreateDesktop false; killall Finder";
alias messydesk="defaults write com.apple.finder CreateDesktop true; killall Finder";
alias install-eslint="exec 3<&1;bash <&3 <(curl https://raw.githubusercontent.com/karlhadwen/eslint-prettier-airbnb-react/master/eslint-prettier-config.sh 2> /dev/null)";
## git aliases
alias gc="git checkout ";
alias gcm="git checkout master";
alias gs="git status";
alias gpull="git pull";
alias gf="git fetch";
alias gfa="git fetch --all";
alias gf="git fetch origin";
alias gpush="git push";
alias gpushf="git push -f";
alias gd="git diff";
alias ga="git add .";
alias glog="git log";
alias gb="git branch";
alias gbr="git branch remote"
alias gfr="git remote update"
alias gbn="git checkout -B "
alias grf="git reflog";
alias grh="git reset HEAD~" # last commit
alias gac="git add . && git commit -a -m "
alias gsu="git gpush --set-upstream origin "
alias glog="git log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --branches"
## npm aliases
alias ni="npm install";
alias nrs="npm run start -s --";
alias nrb="npm run build -s --";
alias nrd="npm run dev -s --";
alias nrt="npm run test -s --";
alias nrtw="npm run test:watch -s --";
alias nrv="npm run validate -s --";
alias rnm="rm -rf node_modules";
## yarn aliases
alias yai="yarn install"; # lists all the scripts we have available
alias yab="yarn build"; # build dist directory for each package
alias yal="yarn lint:fix"; # format source and auto-fix eslint issues
alias yac="yarn commit"; # open a Q&A prompt to help construct valid commit messages
alias yas="yarn start";
alias yasb="yarn storybook:start"; # start storybook
alias yat="yarn test"; # run the unit tests*
alias yatw="yarn test:watch"; #run the unit tests for files changed on save
alias flush-nm="rm -rf node_modules && yarn install && echo Yarn install is done";
## docker
alias dockerstop='docker-compose stop';
alias dockerrestart='docker-compose restart';
alias dockerup='docker-compose up -d';
alias dockerrm='docker-compose rm --all';
## other aliases
alias zshrc='code ~/.zshrc';
alias topten="history | commands | sort -rn | head";
alias myip="curl http://ipecho.net/plain; echo";
alias dirs='dirs -v | head -10';
alias usage='du -h -d1';
alias update="source ~/.zshrc";
alias sshdir="cd ~/.ssh";
alias runp="lsof -i ";
alias md="mkdir ";
alias ..='cd ..';
alias ...='cd ../..';
## this loads NVM
[[ -s $HOME/.nvm/nvm.sh ]] && . $HOME/.nvm/nvm.sh
## custom functions
cd() { builtin cd "$@"; ls -lh; }
glf() { glog --all --grep="$1"; }
gpr() {
if [ $? -eq 0 ]; then
github_url=`git remote -v | awk '/fetch/{print $2}' | sed -Ee 's#(git@|git://)#http://#' -e 's@com:@com/@' -e 's%\.git$%%'`;
branch_name=`git symbolic-ref HEAD 2>/dev/null | cut -d"/" -f 3`;
pr_url=$github_url"/compare/master..."$branch_name
open $pr_url;
else
echo 'failed to open a pull request.';
fi
}
commands() {
awk '{a[$2]++}END{for(i in a){print a[i] " " i}}';
}
export PATH="$HOME/.yarn/bin:$HOME/.config/yarn/global/node_modules/.bin:$PATH"
[ -f "/Users/karl/.shopify-app-cli/shopify.sh" ] && source "/Users/karl/.shopify-app-cli/shopify.sh"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment