Created
March 26, 2019 01:47
-
-
Save fallen90/f15607dacafc5248c0081af63db33de5 to your computer and use it in GitHub Desktop.
Sample zshrc with aliases
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
## Alias functions | |
copyToClipboard(){ | |
# requires xclip | |
xclip -sel c < $1 | |
} | |
gotoProjects(){ | |
cd "/home/fallen90/Projects/${1}" | |
} | |
gotoGoProjects(){ | |
cd "/home/fallen90/go/src/${1}" | |
} | |
listGoProjects(){ | |
ls "/home/fallen90/go/src" | |
} | |
createAnnotatedTag(){ | |
git tag -a $1 -m $1 | |
} | |
createTag(){ | |
git tag $1 | |
} | |
gitPullCurrentBranch(){ | |
ref=$(git symbolic-ref HEAD | cut -d'/' -f3) | |
git pull origin $ref | |
} | |
rsyncAlias(){ | |
rsync -azP $1 $2 | |
} | |
mergeAlias(){ | |
if [ "$1" = "ok" ]; then | |
merge:ok | |
elif [ "$1" = "abort" ]; then | |
merge:abort | |
elif [ "$1" = "q" ]; then | |
merge:abort | |
else | |
merge:branch $1 | |
fi | |
} | |
checkoutRelease(){ | |
checkout "release/v0.${1}" | |
} | |
## end Alias functions | |
#Git | |
alias merge:branch="git merge --no-commit --no-ff" | |
alias merge:abort="git merge --abort" | |
alias merge:ok="git commit -a" | |
alias merge=mergeAlias | |
# checkouts | |
alias checkout="git checkout" | |
alias checkout:master="git checkout master" | |
alias checkout:develop="git checkout develop" | |
alias co:rel=checkoutRelease | |
alias checkout-save="stash; checkout" | |
alias checkout-save:master="stash; checkout:master" | |
alias checkout-save:develop="stash; checkout:develop" | |
#updates | |
alias pull="git pull origin" | |
alias pull:current=gitPullCurrentBranch | |
# fetch | |
alias fetch="git fetch" | |
alias fetch:origin="git fetch origin" | |
#create | |
alias create:branch="git checkout -b" | |
alias create:tag=createAnnotatedTag | |
alias create:tag:lw=createTag | |
#branch | |
alias branch:rename="git branch -m" | |
#stash | |
alias stash:save="git stash" | |
alias stash:restore="git stash pop" | |
alias stash:push="git stash push -m" | |
alias stash:apply="git stash apply" | |
alias stash="stash:save" | |
#git | |
alias commit="git commit -am" | |
alias status="git status" | |
alias sts="git status" | |
alias diff="git diff" | |
#git push | |
alias push="git push" | |
alias push-origin="git push origin" | |
alias push-upstream="git push -u" | |
#git setuser | |
alias git-1day="git config user.name \"Jasper John Cinatad\"; git config user.email \"[email protected]\"" | |
alias git-github="git config user.name \"Jasper John Cinatad\"; git config user.email \"[email protected]\"" | |
#Code | |
alias add-dir="code --add" | |
alias clip=copyToClipboard | |
#meteor | |
alias meteor-ci="meteor --settings .opstream/settings.ci.json" | |
alias meteor-develop="METEOR_BUNDLE_TYPE=modern meteor-ci" | |
alias meteor-debug="meteor-develop --inspect-brk=9229" | |
#portals | |
alias goto=gotoProjects | |
alias goto:go=gotoGoProjects | |
alias goto:desktop="cd /home/fallen90/Desktop" | |
alias goto:downloads="cd /home/fallen90/Downloads" | |
#sourcing zshrc | |
alias reload:zsh="source ~/.zshrc" | |
alias reload:tmux="tmux source-file ~/.tmux.conf" | |
alias edit:zsh="code ~/.zshrc" | |
alias edit:tmux="code ~/.tmux.conf" | |
#backups | |
alias backup:dotfiles="/etc/cron.hourly/0backup-dotfiles" | |
#opening urls | |
alias open="xdg-open" | |
alias open:gitlab="open https://gitlab.com/;" | |
alias open:fb="open https://facebook.com;" | |
alias open:fbmsg="open https://messenger.com;" | |
#meteor | |
alias remove-lock="unlink package-lock.json; unlink yarn.lock" | |
alias remove-package="checkout -- package.json" | |
#rsync | |
alias rsync=rsyncAlias |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment