mac & linux 安装oh my zsh

发布时间 2023-09-08 15:17:56作者: 狐狸已化妖

1、先执行安装命令

mac 安装 zsh 命令

brew install zsh 

linux 安装  zsh 命令

sudo apt-get install zsh

2、安装、切换 oh my zsh

sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
chsh -s /bin/zsh

3、安装oh my zsh 插件

cd ~/.oh-my-zsh/plugins/
git clone https://github.com/zsh-users/zsh-autosuggestions $ZSH_CUSTOM/plugins/zsh-autosuggestions
git clone https://github.com/zsh-users/zsh-completions ${ZSH_CUSTOM}/plugins/zsh-completions
git clone https://github.com/zsh-users/zsh-syntax-highlighting $ZSH_CUSTOM/plugins/zsh-syntax-highlighting
git clone https://github.com/zsh-users/zsh-history-substring-search $ZSH_CUSTOM/plugins/zsh-history-substring-search
git clone https://github.com/zsh-users/web-search $ZSH_CUSTOM/plugins/web-search
git clone https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/web-search $ZSH_CUSTOM/plugins/web-search 

4、安装oh my zsh 主题

cd ~/.oh-my-zsh/themes/
git clone https://github.com/zsh-users/robbyrussell
git clone https://github.com/zsh-users/powerlevel10k/powerlevel10k 

5、在~/.zshrc配置插件和主题

vim ~/.zshrc

输入以下内容

# export PATH=$HOME/bin:/usr/local/bin:$PATH
export ZSH="$HOME/.oh-my-zsh"

ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE="fg=#ff00ff,bg=cyan,bold,underline"

ZSH_WEB_SEARCH_ENGINES=(bl "https://search.bilibili.com?keyword=")

# 主题 ZSH_THEME="robbyrussell" #ZSH_THEME="agnoster" # ZSH_THEME="powerlevel10k/powerlevel10k"
#插件 plugins=( git z zsh-autosuggestions extract web-search
  zsh-syntax-highlighting zsh-history-substring-search zsh-completions macos autojump copyfile copypath ) # Uncomment the following line to use case-sensitive completion. CASE_SENSITIVE="true" # 配置autojump数据库保存路径 ZSH_AUTOJUMP_HOME=/path/to/autojump/database # 当使用shell启动新的终端时是否重新生成bash脚本 ZSH_AUTOJUMP_SH_PASSED=true # 是否只跳转到当前工作目录中的子目录 ZSH_AUTOJUMP_CWD_ONLY=false # 跳转目录时是否匹配更大的匹配项 ZSH_AUTOJUMP_GREEDY=true