首页 > 应用开发 > IT综合 > 你的终端神器之Oh My Zsh
想不想让你的终端变得更漂亮且实用呢,来试试这款神器-- Oh My Zsh。 安装完成后,每次在命令提示符中敲击键盘,你都能体验到数百个强大的插件和精美的主题。
https://github.com/ohmyzsh/ohmyzsh

zsh --version 命令确认)apt install zshbrew install zsh2.4.11 或更高版本apt install gitbrew install git
OhMyZsh是Zsh的一种管理工具,在安装OhMyZsh之前首先得安装Zsh。
Git用来克隆(下载)其代码仓库并管理插件/主题。
brew查看之前文章《用Mac的朋友们,你们都在使用Homebrew了吗》。
命令行安装
# curl方式 sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" # wget方式 sh -c "$(wget -O- https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
如果以上出现网络问题,国内环境可以使用以下链接:
# curl方式 sh -c "$(curl -fsSL https://install.ohmyz.sh/)" # wget方式 sh -c "$(wget -O- https://install.ohmyz.sh/)"

Oh My Zsh 自带大量插件,可以到
~/.oh-my-zsh/plugins目录查看。
插件的详细介绍可以去 https://github.com/ohmyzsh/ohmyzsh/wiki/Plugins 查看。

编辑
vi ~/.zshrc,添加插件名称以启用插件。
plugins=( git macos )
注意:插件之间用空格(空格、制表符、换行符等)分隔。 请勿使用逗号,否则插件会出错
推荐两款我自用的:
# zsh-autosuggestions
git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
# zsh-syntax-highlighting
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
plugins=( # ... zsh-autosuggestions zsh-syntax-highlighting )
Oh My Zsh 自带的主题非常丰富,可以到
~/.oh-my-zsh/themes目录查看。
主题对应的界面效果可以到 https://github.com/ohmyzsh/ohmyzsh/wiki/Themes 查看

编辑
vi ~/.zshrc,更改你选择的主题名称。
ZSH_THEME="robbyrussell"
如果自带主题没有满意的,你也可以使用第三方主题。
https://github.com/romkatv/powerlevel10k,有人称为此主题为 天和之作,不过此主题已经处于 非活跃的状态了。
https://github.com/romkatv/powerlevel10k#meslo-nerd-font-patched-for-powerlevel10k
MesloLGS NF

终端执行:
git clone --depth=1 https://github.com/romkatv/powerlevel10k.git "${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k"
国内环境:
git clone --depth=1 https://gitee.com/romkatv/powerlevel10k.git "${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k"
ZSH_THEME="powerlevel10k/powerlevel10k"
终端执行(重开终端或执行
source ~/.zshrc):
p10k configure
终端交互式,根据自己喜好选择即可。

如果安装后你觉得不好用,卸载也很简单。
uninstall_oh_my_zsh
现在你的终端看上去已经很酷炫了,但在使用
top时会显得很平庸,你可以安装一个更好看的工具
btop。
https://github.com/aristocratos/btop
# Linux dnf install btop # macOS brew install btop
终端执行:
btop

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/70047890/viewspace-3114823/ ,如需转载,请注明出处,否则将追究法律责任。