oh-my-zsh插件推荐

一些常用的插件

## 插件配置 大部分插件基本已经内置了,除了少部分才需要手动添加 `~/.oh-my-zsh/plugins`里面有默认自带的近百插件,配置后即可启用,如图:

参考此处 安装好 zsh 和 oh-my-zsh 后,打开文件~/.zshrc,其中有如下行:

1
plugins=(git)

将需要的插件按空格分开,放于此处即可。我的配置如下:

1
2
3
4
5
6
7
plugins=(
git
autojump
sublime
zsh-autosuggestions
zsh-syntax-highlighting
)

修改完后,如果需要在当前shell中生效,需要执行

1
$ source ~/.zshrc

插件推荐

zsh-autosuggestions (历史命令智能提示)

下载插件

1
$ git clone https://github.com/zsh-users/zsh-autosuggestions.git $ZSH_CUSTOM/plugins/zsh-autosuggestions

~/.zshrc中配置

1
plugins=(其他插件 zsh-autosuggestions)

使配置生效

1
$ source ~/.zshrc

zsh-syntax-highlighting (命令高亮 ,路径自带下划线)

同上

1
$ git clone https://github.com/zsh-users/zsh-syntax-highlighting.git $ZSH_CUSTOM/plugins/zsh-syntax-highlighting

autojump (常用目录快速跳转)

下载插件

1
$ git clone https://github.com/joelthelion/autojump.git

进入目录,执行

1
$ ./install.py

~/.zshrc中配置

1
plugins=(其他插件 autojump)

把以下代码加入 .zshrc:

1
[[ -s ~/.autojump/etc/profile.d/autojump.sh ]] && . ~/.autojump/etc/profile.d/autojump.sh

使配置生效

1
$ source ~/.zshrc

sublime (在终端使用 Sublime Text 打开文件、项目)

命令 作用
st 打开 sublime
st + 文件夹 打开该文件夹
st + 文件 打开该文件
stt 打开当前的文件夹,相当于 st .
sst 管理员权限 相当于 sudo st

虽然 oh-my-zsh 提供了很多插件,不过也不要贪多,大量的插件会拖慢打开的速度,因此只安装你常用的就好了。