# zsh plugin
plugins=(macos vi-mode)
# auto complete
autoload -U compinit && compinit
zstyle ':completion:*' menu select
# homebrew
export HOMEBREW_NO_AUTO_UPDATE=1
export HOMEBREW_NO_ANALYTICS=1
export HOMEBREW_NO_INSTALL_CLEANUP=1
eval "$(/opt/homebrew/bin/brew shellenv)"
# suggestion
fpath=(/opt/homebrew/opt/zsh-completions/share/zsh-completions $fpath)
source /opt/homebrew/opt/zsh-autosuggestions/share/zsh-autosuggestions/zsh-autosuggestions.zsh
# starship!
eval "$(starship init zsh)"
# utils
export LC_ALL=en_US.UTF-8
set -o vi
# up/down search key binding
bindkey "^[[A" history-beginning-search-backward
bindkey "^[[B" history-beginning-search-forward
# nvm
use-nvm() {
source /opt/homebrew/opt/nvm/nvm.sh
source /opt/homebrew/opt/nvm/etc/bash_completion.d/nvm
}
alias cnpm="npm --registry=https://registry.npmmirror.com \
--cache=$HOME/.npm/.cache/cnpm \
--disturl=https://npmmirror.com/mirrors/node \
--userconfig=$HOME/.cnpmrc"
# rust
# dependencies: 'cargo install cargo-zigbuild' and 'brew install zig'
alias cargo-windows='cargo zigbuild --target x86_64-pc-windows-gnu'
alias cargo-linux='cargo zigbuild --target x86_64-unknown-linux-musl'
# proxy
export proxy_port=7890
use-http-proxy() {
export http_proxy=socks5h://127.0.0.1:$proxy_port
export https_proxy=socks5h://127.0.0.1:$proxy_port
export HTTP_PROXY=socks5h://127.0.0.1:$proxy_port
export HTTPS_PROXY=socks5h://127.0.0.1:$proxy_port
export DEFAULT_JVM_OPTS="-Dhttp.proxyHost=127.0.0.1 -Dhttp.proxyPort=7890"
}
no-http-proxy() {
unset http_proxy
unset https_proxy
unset HTTP_PROXY
unset HTTPS_PROXY
unset DEFAULT_JVM_OPTS
}
proxy-ssh() {
ssh -o ProxyCommand="nc -v -x 127.0.0.1:$proxy_port %h %p" $@
}
proxy-scp() {
scp -o ProxyCommand="nc -v -x 127.0.0.1:proxy_port %h %p" $@
}
use-git-proxy() {
export GIT_SSH_COMMAND='ssh -o ProxyCommand="nc -v -x 127.0.0.1:$proxy_port %h %p"'
}
no-git-proxy() {
unset GIT_SSH_COMMAND
}
# utility
alias gp='git pull --rebase --recurse-submodules'
alias tuna-pip-install='pip install -i https://pypi.tuna.tsinghua.edu.cn/simple'
alias tuna-pip-setup='pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple'
alias utm-clear='rm ~/Library/Containers/com.utmapp.UTM/.com.apple.containermanagerd.metadata.plist'
alias use-jemalloc='export DYLD_INSERT_LIBRARIES=/opt/homebrew/opt/jemalloc/lib/libjemalloc.dylib'
# init
use-http-proxy
use-git-proxy
channels:
- defaults
show_channel_urls: true
auto_activate_base: false
default_channels:
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/r
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/msys2
custom_channels:
conda-forge: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
msys2: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
bioconda: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
menpo: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
pytorch: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
pytorch-lts: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
simpleitk: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
[http ]
proxy = " http://127.0.0.1:7890"
[net ]
git-fetch-with-cli = true
[profile .release ]
strip = true
lto = true
[core]
quotepath = false
[init]
defaultBranch = main
[filter "lfs"]
clean = git-lfs clean -- %f
smudge = git-lfs smudge -- %f
process = git-lfs filter-process
required = true
[url "git@github.com:"]
insteadOf = https://github.com/
Host *
ServerAliveInterval 15
Host github.com
ProxyCommand nc -v -x 127.0.0.1:7890 %h %p
edition =" 2021"
group_imports =" StdExternalCrate"
imports_granularity =" Crate"
reorder_imports =true
reorder_modules =true
---
IndentWidth: 4
TabWidth: 4
UseTab: Never
Standard: Cpp11
AccessModifierOffset: -4
AlignAfterOpenBracket: Align
AlignConsecutiveAssignments: true
AlignConsecutiveDeclarations: true
AlignEscapedNewlines: Left
AlignOperands: true
AlignTrailingComments: true
AllowAllParametersOfDeclarationOnNextLine: false
AllowShortBlocksOnASingleLine: false
AllowShortFunctionsOnASingleLine: Empty
AllowShortIfStatementsOnASingleLine: false
AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: false
AlwaysBreakTemplateDeclarations: true
BinPackParameters: false
BreakBeforeBraces: Custom
BraceWrapping:
AfterClass: false
AfterControlStatement: false
AfterEnum: false
AfterFunction: false
AfterNamespace: false
AfterStruct: false
AfterUnion: false
AfterExternBlock: false
BeforeCatch: false
BeforeElse: false
SplitEmptyFunction: false
SplitEmptyRecord: false
SplitEmptyNamespace: false
BreakBeforeBinaryOperators: None
BreakBeforeBraces: Custom
BreakBeforeInheritanceComma: true
BreakBeforeTernaryOperators: true
BreakConstructorInitializers: BeforeComma
BreakStringLiterals: true
ColumnLimit: 100
CompactNamespaces: true
ConstructorInitializerAllOnOneLineOrOnePerLine: false
Cpp11BracedListStyle: true
FixNamespaceComments: true
ForEachMacros: ['BOOST_FOREACH']
IncludeBlocks: Regroup
IndentCaseLabels: true
IndentPPDirectives: AfterHash
MaxEmptyLinesToKeep: 2
NamespaceIndentation: All
PointerAlignment: Right
SortIncludes: true
SortUsingDeclarations: true
SpaceAfterCStyleCast: false
SpaceAfterTemplateKeyword: false
SpaceBeforeAssignmentOperators: true
#SpaceBeforeCtorInitializerColon: true
#SpaceBeforeInheritanceColon: true
SpaceBeforeParens: ControlStatements
#SpaceBeforeRangeBasedForLoopColon: true
SpaceInEmptyParentheses: false
SpacesInAngles: false
SpacesInCStyleCastParentheses: false
SpacesInContainerLiterals: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
BinPackArguments: false
BinPackParameters: false
ExperimentalAutoDetectBinPacking: false
AllowAllParametersOfDeclarationOnNextLine: false
config_path=$( ls $HOME /Library/Preferences/ByHost/com.apple.loginwindow.* .plist) # config file for loginwindow
chmod 000 $config_path # prevent osx from touch this file, can't delete, osx will recreate it.
Podman with docker /etc/containers/registries.conf
[registries.search]
registries = ['docker.io']
export PUB_HOSTED_URL=https://pub.flutter-io.cn
export FLUTTER_STORAGE_BASE_URL=https://storage.flutter-io.cn
export HOMEBREW_API_DOMAIN=" https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles/api"
export HOMEBREW_BOTTLE_DOMAIN=" https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles"
export HOMEBREW_BREW_GIT_REMOTE=" https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git"
export HOMEBREW_CORE_GIT_REMOTE=" https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git"
export HOMEBREW_PIP_INDEX_URL=" https://pypi.tuna.tsinghua.edu.cn/simple"