Oh My Zsh是什么

官方的简介如下

Oh My Zsh is a delightful, open source, community-driven framework for managing your Zsh configuration. It comes bundled with thousands of helpful functions, helpers, plugins, themes, and a few things that make you shout...

译文就是

Oh My Zsh 是一个令人愉快的、开源的、社区驱动的框架,用于管理您的 Zsh 配置。它捆绑了数千个有用的功能、帮助器、插件、主题以及一些让您大喊大叫的东西...

简单的说,Oh My Zsh能够增强命令行工具,美化控制台,提供强大的控制台功能。

Oh My Zsh安装

在mac上可以直接通过命令行安装,拷贝下面命令执行

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

如果网络不允许安装,可以尝试下面gitee镜像

sh -c "$(curl -fsSL https://gitee.com/mirrors/oh-my-zsh/raw/master/tools/install.sh)"

安装完成后,zsh还没有什么功能,我们需要通过插件来扩展它。目前所有zsh可用的插件可以通过 Plugins-Overview 来查阅。

Oh My Zsh主题

oh my zsh安装完成后,我们可以在 ~/.zshrc 文件里面进行配置主题

# 找到 ZSH_THEME
# random是随机,每次打开命令行都有新鲜感
ZSH_THEME="random"

Oh My Zsh插件推荐

通过上文的插件目录可以看到,zsh提供了很多插件,但是我们没必要所有都安装,按需安装即可,作为开发常用的插件有以下几个。

zsh-autosuggestions

这个插件可以通过历史记录实现自动补全,非常nice,减少敲重复命令步骤。

git clone --depth=1 https://github.com/zsh-users/zsh-autosuggestions.git ${ZSH_CUSTOM:-${ZSH:-~/.oh-my-zsh}/custom}/plugins/zsh-autosuggestions

进入 .zshrc 文件,在 plugins 块新增如下 zsh-autosuggestions 插件

plugins=(
   git
   # other plugins...
   zsh-autosuggestions
)

zsh-syntax-highlighting

语法高亮插件

git clone --depth=1 https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
plugins=(
   git
   # other plugins...
   zsh-syntax-highlighting
)
本文为原创,未经授权,禁止任何媒体或个人自媒体转载
商业侵权必究,如需授权请联系[email protected]
标签: 工具