字节笔记本字节笔记本

ohmyzsh配置分享

2022-07-21

本文分享了两个ohmyzsh的配置文件,包括环境变量设置、插件管理、历史记录配置、代理功能以及各种开发工具的路径配置。

ohmyzsh配置分享

source ~/.zplug/init.zsh
# If you come from bash you might have to change your $PATH.
# export PATH=$HOME/bin:/usr/local/bin:$PATH

# Path to your oh-my-zsh installation.
export ZSH="/Users/pan/.oh-my-zsh"
ZSH_THEME="robbyrussell"

# > zsh插件
plugins=()

# >  History config
HISTSIZE=10000
SAVEHIST=10000
HISTFILE=~/.zsh_history

# > zplug 安装插件
zplug "powerlevel9k/powerlevel9k", as:theme, depth:1
zplug 'zplug/zplug', hook-build:'zplug --self-manage'
zplug "plugins/git", from:oh-my-zsh
zplug "plugins/macos", from:oh-my-zsh
zplug "plugins/vscode", from:oh-my-zsh
zplug "plugins/z", from:oh-my-zsh
zplug "plugins/d", from:oh-my-zsh
zplug "plugins/extract", from:oh-my-zsh
zplug "plugins/git-open", from:oh-my-zsh
zplug "plugins/sudo", from:oh-my-zsh
zplug "plugins/cp", from:oh-my-zsh
zplug "plugins/web-search", from:oh-my-zsh
zplug "plugins/rand-quote", from:oh-my-zsh
zplug "plugins/history-substring-search", from:oh-my-zsh
zplug "plugins/command-not-found", from:oh-my-zsh
zplug "zsh-users/zsh-syntax-highlighting"
zplug "zsh-users/zsh-autosuggestions"
zplug "voronkovich/gitignore.plugin.zsh"

source $ZSH/oh-my-zsh.sh

[ -f /usr/local/etc/profile.d/autojump.sh ] && . /usr/local/etc/profile.d/autojump.sh
source /usr/local/share/zsh-autosuggestions/zsh-autosuggestions.zsh
export MAVEN_HOME=/Users/pan/apache-maven-3.6.3
export PATH=$MAVEN_HOME/bin:$PATH
export FLUTTER_STORAGE_BASE_URL=https://storage.flutter-io.cn
export PATH=/Users/pan/code/flutter/bin:$PATH
export PATH=/usr/local/Cellar/node/16.5.0/bin:$PATH
export GOPATH=/Users/pan/go
export GOBIN=$GOPATH/bin
export PATH=$PATH:$GOBIN

# 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

# PNPM
export PNPM_HOME="/Users/pan/Library/pnpm"
export PATH="$PNPM_HOME:$PATH"

test -e "${HOME}/.iterm2_shell_integration.zsh" && source "${HOME}/.iterm2_shell_integration.zsh"

# > JAVA_HOME
export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_291.jdk/Contents/Home
export CLASSPAHT=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
export PATH=$JAVA_HOME/bin:$PATH:

export PATH="/Users/pan/.deno/bin:$PATH"

# > GOPROXY
export GOPROXY=https://goproxy.io,direct
export PATH="$PATH:/Users/pan/.local/bin"

# > 开启代理
function on() {
    export ALL_PROXY=socks5://127.0.0.1:1080
    export http_proxy=http://127.0.0.1:1081
    export https_proxy=http://127.0.0.1:1081
    echo -e "已开启代理"
}
# > 关闭代理
function off() {
    unset ALL_PROXY
    unset http_proxy
    unset https_proxy
    echo -e "已关闭代理"
}

export PATH="$HOME/.pyenv/bin:$PATH"
eval "$(pyenv init -)"
eval "$(pyenv virtualenv-init -)"
export PATH="$PATH:/Users/pan/Documents/flutter/bin"

export NO_PROXY=localhost,127.0.0.1

# > zplug 安装检查
if ! zplug check --verbose; then
    printf "Install? [y/N]: "
    if read -q; then
        echo
        zplug install
    fi
fi

# > zplug 安装
zplug load

#别名配置
alias tree="find . -print | sed -e 's;[^/]*/;|____;g;s;____|; |;g'"
alias la='ls -la'
alias f='fanyi'
alias jc='j code'
alias jd='j Desktop'

export PROMPT=""

另一个参考配置

export ZSH="/Users/pan/.oh-my-zsh"
ZSH_THEME="agnoster"

# > zsh插件
plugins=(zsh-autosuggestions  autojump zsh-syntax-highlighting)

# >  History config
HISTSIZE=10000
SAVEHIST=10000
HISTFILE=~/.zsh_history


source $ZSH/oh-my-zsh.sh

# source /usr/local/share/zsh-autosuggestions/zsh-autosuggestions.zsh
export MAVEN_HOME=/Users/pan/apache-maven-3.6.3
export PATH=$MAVEN_HOME/bin:$PATH
export FLUTTER_STORAGE_BASE_URL=https://storage.flutter-io.cn
export PATH=/Users/pan/code/flutter/bin:$PATH
export PATH=/usr/local/Cellar/node/16.5.0/bin:$PATH
export GOPATH=/Users/pan/go
export GOBIN=$GOPATH/bin
export PATH=$PATH:$GOBIN

# 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

# PNPM
export PNPM_HOME="/Users/pan/Library/pnpm"
export PATH="$PNPM_HOME:$PATH"

test -e "${HOME}/.iterm2_shell_integration.zsh" && source "${HOME}/.iterm2_shell_integration.zsh"

# > JAVA_HOME
export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_291.jdk/Contents/Home
export CLASSPAHT=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
export PATH=$JAVA_HOME/bin:$PATH:

export PATH="/Users/pan/.deno/bin:$PATH"

# flutrer

export PATH="$PATH:/Users/pan/dev/flutter/bin"

# > GOPROXY
export GOPROXY=https://goproxy.io,direct
export PATH="$PATH:/Users/pan/.local/bin"

# > 开启代理
function on() {
    export ALL_PROXY=socks5://192.168.2.236:1080
    export http_proxy=http://192.168.2.236:1081
    export https_proxy=socks5://192.168.2.236:1081
    echo -e "已开启代理"
}
# > 关闭代理
function off() {
    unset ALL_PROXY
    unset http_proxy
    unset https_proxy
    echo -e "已关闭代理"
}

export PATH="$HOME/.pyenv/bin:$PATH"
export PATH="$PATH:/Users/pan/Documents/flutter/bin"

export NO_PROXY=localhost,127.0.0.1

[[ -s `brew --prefix`/etc/autojump.sh ]] && . `brew --prefix`/etc/autojump.sh


export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles/
___MY_VMOPTIONS_SHELL_FILE="${HOME}/.jetbrains.vmoptions.sh"; if [ -f "${___MY_VMOPTIONS_SHELL_FILE}" ]; then . "${___MY_VMOPTIONS_SHELL_FILE}"; fi