diff --git a/files/zsh/.zsh_user b/files/zsh/.zsh_user index 135eda6..87481d2 100644 --- a/files/zsh/.zsh_user +++ b/files/zsh/.zsh_user @@ -2,28 +2,3 @@ # ZSH_THEME="robbyrussell" # PROMPT='%(?:%{$fg_bold[green]%}:%{$fg_bold[red]%})${HOST:-} %{$fg[cyan]%}%c%{$reset_color%} $(git_prompt_info)' - -command_exists() { command -v "$@" >/dev/null 2>&1; } - -# pip3 -export PATH=$PATH:$HOME/.local/bin -command_exists trash-put && alias rm='trash-put' - -# Docker -# export DOCKER_HOST=unix:///run/user/500/docker.sock -# export DOCKER_HOST=unix:///run/user/1000/docker.sock - -# Yarn -# export PATH=$PATH:$HOME/.yarn/bin - -# Golang -# export PATH=$PATH:/usr/local/go/bin -# export PATH=$PATH:$HOME/.local/go/bin -# export GOPROXY=https://goproxy.cn,direct - -# Node.js, npm, nvm -# export NVM_NODEJS_ORG_MIRROR=https://npmmirror.com/mirrors/node -# export NVM_IOJS_ORG_MIRROR=https://npmmirror.com/mirrors/iojs - -# WSL Xming -# export DISPLAY=:0; diff --git a/files/zsh/80-env.zsh b/files/zsh/80-env.zsh new file mode 100644 index 0000000..c554104 --- /dev/null +++ b/files/zsh/80-env.zsh @@ -0,0 +1,27 @@ +# Pip3 +if [ -d "$HOME/.local/bin" ]; then + export PATH=$PATH:$HOME/.local/bin + command_exists trash-put && alias rm='trash-put' +fi + +# Docker +if [ -f "~/.config/systemd/user/docker.service" ]; then + export DOCKER_HOST=unix:///run/user/$(id -u)/docker.sock +fi + +# Golang +if command_exists go; then + export PATH=$PATH:/usr/local/go/bin + export PATH=$PATH:$HOME/.local/go/bin +fi + +# Yarn +if [ -d "$HOME/.yarn" ]; then + export PATH=$PATH:$HOME/.yarn/bin +fi + +# WSL1 +if grep -q Microsoft /proc/version; then + # Xming + export DISPLAY=:0; +fi diff --git a/files/zsh/81-proxy.zsh b/files/zsh/81-proxy.zsh new file mode 100644 index 0000000..ed8b3db --- /dev/null +++ b/files/zsh/81-proxy.zsh @@ -0,0 +1,11 @@ +# Golang +if command_exists go; then + export GO111MODULE=on + export GOPROXY=https://goproxy.cn,direct +fi + +# Node.js, npm, nvm +if [ -d "$HOME/.nvm" ]; then + export NVM_NODEJS_ORG_MIRROR=https://npmmirror.com/mirrors/node + export NVM_IOJS_ORG_MIRROR=https://npmmirror.com/mirrors/iojs +fi diff --git a/init_priv.sh b/init_priv.sh index 1aec92d..0d6bea4 100755 --- a/init_priv.sh +++ b/init_priv.sh @@ -113,6 +113,8 @@ configure_zsh() { cp $scriptdir/files/zsh/10-theme.zsh ~/.oh-my-zsh/custom/ cp $scriptdir/files/zsh/20-function.zsh ~/.oh-my-zsh/custom/ cp $scriptdir/files/zsh/50-alias.zsh ~/.oh-my-zsh/custom/ + cp $scriptdir/files/zsh/80-env.zsh ~/.oh-my-zsh/custom/ + cp $scriptdir/files/zsh/81-proxy.zsh ~/.oh-my-zsh/custom/ cp $scriptdir/files/zsh/90-other.zsh ~/.oh-my-zsh/custom/ cp $scriptdir/files/zsh/ys-simple.zsh-theme ~/.oh-my-zsh/custom/themes/ fi diff --git a/init_user.sh b/init_user.sh index 2415122..002c873 100755 --- a/init_user.sh +++ b/init_user.sh @@ -82,6 +82,8 @@ update_file $scriptdir/files/zsh/00-init.zsh ~/.oh-my-zsh/custom/00-init update_file $scriptdir/files/zsh/10-theme.zsh ~/.oh-my-zsh/custom/10-theme.zsh update_file $scriptdir/files/zsh/20-function.zsh ~/.oh-my-zsh/custom/20-function.zsh update_file $scriptdir/files/zsh/50-alias.zsh ~/.oh-my-zsh/custom/50-alias.zsh +update_file $scriptdir/files/zsh/80-env.zsh ~/.oh-my-zsh/custom/80-env.zsh +update_file $scriptdir/files/zsh/81-proxy.zsh ~/.oh-my-zsh/custom/81-proxy.zsh update_file $scriptdir/files/zsh/90-other.zsh ~/.oh-my-zsh/custom/90-other.zsh update_file $scriptdir/files/zsh/ys-simple.zsh-theme ~/.oh-my-zsh/custom/themes/ys-simple.zsh-theme update_authorized_keys