Last active
December 5, 2019 12:01
-
-
Save lianghx-319/644375acf92adf4072beabe27dfca74d to your computer and use it in GitHub Desktop.
zshrc
This file contains hidden or 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
# Open .zshrc to be edited in VS Code | |
alias change="code ~/.zshrc" | |
# Re-run source command on .zshrc to update current terminal session with new settings | |
alias update="source ~/.zshrc" | |
alias ~="cd ~" | |
alias ..="cd .." | |
alias ...="cd ../../" | |
alias c="clear" | |
# Yanr Aliases | |
alias yfe="yarn --registry=http://levy.ren:4873" | |
alias ytb="yarn --registry=https://registry.npm.taobao.org" | |
alias ytba="yarn --registry=https://registry.npm.taobao.org add" | |
alias ytbd="yarn --registry=https://registry.npm.taobao.org add -D" | |
alias ya="yarn add" | |
alias yad="yarn add -D" | |
alias yag="yarn global add" | |
alias yrm="yarn remove" | |
alias yup="yarn upgrade" | |
alias yupl="yarn upgrade --latest" | |
# Find repos | |
alias wrepo="projj find" | |
# Git Aliases | |
alias gclone="projj add" | |
alias gco="git checkout" | |
alias gcm="git commit -m" | |
alias gcam='git commit -a -m' | |
alias gca="git commit --amend --no-edit" | |
alias gcae="git commit --amend" | |
alias gcaa="git add --all && git commit --amend --no-edit" | |
alias gcaae="git add --all && git commit --amend" | |
alias gap="git add -p" | |
alias gnope="git checkout ." | |
alias gwait="git reset HEAD" | |
alias gundo="git reset --soft HEAD^" | |
alias greset="git clean -f && git reset --hard HEAD" # Removes all changes, even untracked files | |
alias gl="git log --graph --pretty='%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit" | |
alias glb='git log --oneline --decorate --graph --all' | |
alias gst='git status -s' | |
alias gpl="git pull --rebase" | |
alias gps="git push" | |
alias gpsf="git push --force-with-lease" | |
alias grp="git remote prune" | |
alias grb="git rebase" | |
alias grbi='git rebase -i' | |
alias grba='git rebase --abort' | |
alias grbc='git rebase --continue' | |
# Remove local branches that have already been merged in the remote repository | |
alias gcmb="git branch --merged | grep -Ev '(^\*|master|dev|qa)' | xargs git branch -d" | |
# Sets the upstream branch to be the same branch as the locally named branch | |
alias gset='git branch --set-upstream-to=origin/`git symbolic-ref --short HEAD`' | |
# push gh-pages with subtree | |
ghpages() {git subtree push --prefix "$1" "$2" gh-pages} | |
# Do an interactive rebase back N number of commits (e.g. grn 3) | |
grn() { git rebase -i HEAD~"$1"; } | |
# Do an interactive rebase to a supplied commit hash (e.g. grbc 80e1625) | |
grbic() { git rebase -i "$1"; } | |
# Create a gitignore | |
function gi() { curl -sLw n https://www.gitignore.io/api/$@ ;} | |
# settings about proxy | |
proxy () { | |
export http_proxy="http://127.0.0.1:7890" | |
export https_proxy="http://127.0.0.1:7890" | |
echo "HTTP Proxy on" | |
} | |
noproxy () { | |
unset http_proxy | |
unset https_proxy | |
echo "HTTP Proxy off" | |
} | |
#------------------ | |
# Zsh hooks | |
#------------------ | |
# Enable the addition of zsh hook functions | |
autoload -U add-zsh-hook | |
# Set the tab title to the current working directory before each prompt | |
function tabTitle () { | |
window_title="\033];${PWD##*/}\007" | |
echo -ne "$window_title" | |
} | |
# Executes load-nvmrc when the present working directory (pwd) changes | |
# add-zsh-hook chpwd load-nvmrc | |
# Executes tabTitle before each prompt | |
add-zsh-hook precmd tabTitle | |
# load Ruby | |
eval "$(rbenv init -)" | |
alias l='colorls --group-directories-first --almost-all' | |
# detailed list view | |
alias ll='colorls --group-directories-first --almost-all --long' | |
# Set Spaceship ZSH as a prompt | |
autoload -U promptinit compinit; promptinit | |
rm -f ~/.zcompdump; compinit | |
prompt spaceship | |
# Golang | |
export PATH="/usr/local/opt/[email protected]/bin:$PATH" | |
# source nvm | |
export NVM_DIR="$HOME/.nvm" | |
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm | |
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion | |
# load autosuggestions | |
source /usr/local/share/zsh-autosuggestions/zsh-autosuggestions.zsh | |
# source z.sh | |
. /usr/local/etc/profile.d/z.sh | |
# zsh completions | |
fpath=(/usr/local/share/zsh-completions $fpath) | |
# this must be at the end of .zshrc | |
source /usr/local/share/zsh/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment