Skip to content

Instantly share code, notes, and snippets.

@zorchp
Last active August 11, 2023 11:44
Show Gist options
  • Save zorchp/a0a5e4e57c1f37f94aafabe36262c684 to your computer and use it in GitHub Desktop.
Save zorchp/a0a5e4e57c1f37f94aafabe36262c684 to your computer and use it in GitHub Desktop.
Alias and Brew config for MacOS with zsh
export PATH="/usr/local/texlive/2023/bin/universal-darwin:$PATH"
export PATH="/opt/homebrew/bin:/usr/local/bin:$PATH"
# brew git mirrors: update for brew 4.0.0
export HOMEBREW_BOTTLE_DOMAIN="https://mirrors.ustc.edu.cn/homebrew-bottles"
export HOMEBREW_API_DOMAIN="https://mirrors.ustc.edu.cn/homebrew-bottles/api"
# brew auto completion
if type brew &>/dev/null
then
FPATH="$(brew --prefix)/share/zsh/site-functions:${FPATH}"
autoload -Uz compinit
compinit
fi
# -----auto completion
############## zsh ################
### ZSH HOME
export ZSH=$HOME/.zsh
# prompt
NEWLINE=$'\n'
PROMPT="%(?.%F{green}√.%F{red}?%?)%f %B%F{69}%~ ${NEWLINE} %F{35}==>%f%b "
### ---- history config --------------
export HISTFILE=$ZSH/.zsh_history
# How many commands zsh will load to memory.
export HISTSIZE=10000
# How maney commands history will save on file.
export SAVEHIST=10000
# History won't save duplicates.
setopt HIST_IGNORE_ALL_DUPS
# History won't show duplicates on search.
setopt HIST_FIND_NO_DUPS
source $ZSH/plugins/fast-syntax-highlighting/fast-syntax-highlighting.plugin.zsh
fpath=($ZSH/plugins/zsh-completions/src $fpath)
# zsh-autosuggestions:config
source $ZSH/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh
ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE="fg=#ff00ff,bg=cyan,bold,underline"
ZSH_AUTOSUGGEST_STRATEGY=(history completion)
ZSH_AUTOSUGGEST_BUFFER_MAX_SIZE=20
# end config
################### alias here #####################
alias vi=nvim
alias vim='nvim'
# alias vrc='vi ~/.vimrc'
alias vv='cd ~/.config/nvim/lua/'
alias snip='vi ~/.config/nvim/my-snippets/snippets/'
alias vz='vim ~/.zshrc'
alias sz='source ~/.zshrc'
########################## MacOS ##############
alias ibrew='arch -x86_64 /usr/local/bin/brew'
alias brewbak='brew bundle dump --describe --force --file="~/code/dotfile/MacOS/Brewfile"'
alias brewclean='brew cleanup --prune 0'
alias calc="open -a calculator.app"
alias tid="sudo sed -i ".bak" '2s/^/auth sufficient pam_tid.so\'$'\n/g' /etc/pam.d/sudo"
alias batinfo="ioreg -w 0 -f -r -c AppleSmartBattery | grep -E 'AppleRawMaxCapacity|AppleRawCurrentCapacity'"
alias archs='lipo -archs'
alias refreshlaunch='defaults write com.apple.dock ResetLaunchPad -bool TRUE;killall Dock'
alias diskinfo='smartctl -a disk0'
alias xc='xcode-select --install'
alias anywhere='sudo spctl --master-disable'
# alias frpc="frpc -c /opt/homebrew/etc/frp/frpc.ini"
alias re_launchpad="defaults write com.apple.dock ResetLaunchPad -bool true; killall Dock"
# ################ cc ASM #######################
alias gcc=gcc-13
alias g++=g++-13
alias lc="cd ~/code/dsa/lc/"
alias ccc='cd ~/code/c-cpp_Proj/Learn_C_CPP/'
alias asm="cd ~/code/asm/Learning_ASM/CODE/"
alias stl="cd ~/code/c-cpp_Proj/Learn_C_Cpp/STL/"
alias rmexe='find . -perm +100 -type f -delete'
# ########### TeX #####################
alias tx-u='sudo tlmgr update --self --all'
alias tx-reu='sudo tlmgr update --reinstall-forcibly-removed --all'
alias pdf2png='pdf_to_png() {gs -sDEVICE=png16m -sBATCH -sOutputFile=$2 -dNOPAUSE -r1600 $1;}; pdf_to_png'
alias togif='figtogif() {sips -s format gif $1 -o $2;}; figtogif'
alias td='texdoc'
alias lst="td lshort-zh"
alias pgf="td pgf"
alias tt='cd /Users/hep/code/LaTeX_Proj/latex-test/'
# ############## proxy #####################
alias v1='open -a /Applications/ClashX.app'
alias v2='export https_proxy=http://127.0.0.1:7890 http_proxy=http://127.0.0.1:7890 all_proxy=socks5://127.0.0.1:7890'
alias uv="unset ALL_PROXY"
############## Python ##############################
alias ipy='ipython'
alias jn='jupyter-notebook'
alias py38='conda activate py38'
alias py39='conda activate py39'
alias pyauto='conda activate pyauto'
alias py3x='conda activate py3x'
alias py3xi='conda activate py3xi'
alias de='conda deactivate'
alias vipy='vim /Users/hep/.ipython/profile_default/ipython_config.py'
alias py="/opt/homebrew/Caskroom/miniforge/base/envs/py3x/bin/python3"
# alias python="/opt/homebrew/bin/python3"
alias t_py="cd ~/code/py_Proj/rest_Code/"
# ################### git #####################
# alias ga='git add .'
# alias gc='echo $1|git commit -m $1'
# alias gp='git push'
alias gt='func() {git add .&&git commit -m "$1"&& git push;};func'
alias gcl='git clone'
alias help=run-help
# ################### frontend-tools #####################
alias blg='cd ~/code/frontend-tools/zorchp.github.io'
alias bjs='bundle exec jekyll serve'
alias js='jekyll server'
alias sql='mysql -uroot -pabcd'
alias qa='func_qa() { curl -d "search=$1" "http://gpt.kube.moguit.cn/text"; }; func_qa'
#alias rm='rm -i'
####################### Linux VM Ubuntu ##################
alias vm='multipass'
alias mac='ifconfig -a | awk "{print $2}" | grep "18" | tr ":" "-"'
alias i='arch -x86_64 '
alias tn='tmux new -s'
alias ll='ls -alh'
alias cl=clear
alias h=history
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment