oh my zsh常用插件安装

110次阅读
没有评论

oh my zsh 常用插件安装
转载自:https://hufangyun.com/2017/zsh-plugin/

oh my zsh 自带很多插件,插件目录在 ~/.oh-my-zsh/plugins/,可以参考官网文档,启用一些自己喜欢的插件。

git

默认已开启

作用

可以使用各种 git 命令缩写。😋

比如

git add --all ===> gaa
git commit -m ===> gcmsg

查看所有 git 命令缩写

cat ~/.oh-my-zsh/plugins/git/git.plugin.zsh

或者筛选对应的命令,如和 config 有关的命令

alias | grep config

autojump

autojump 官网 https://github.com/wting/autojump

作用 目录间快速跳转, 不用再一直 cd 了 😁

使用

使用 autojump 的缩写 j

cd 命令进入 ~/user/github/Youthink 文件夹,下一次再想进入 Yourhink 文件夹的时候, 直接 j youthink 即可,或者只输入 youthink 的一部分 youth 都行

  • 删除无效路径

    j --purge 无效路径
  • 打开 muisc 文件夹

    jo music
  • 多个参数一起使用 打开 /home/user/work/inbox

    j w in

Z 不同 autojump 不是 zsh 内置的插件,需要额外安装。

首先安装 autojump,如果你用 Mac,可以使用 brew 安装:

brew install autojump

如果是 Linux,可以使用 git 安装,比如:

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

进入目录,执行

./install.py

.zshrc 启用插件
最后把以下代码加入 .zshrc

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

Z

如果你不想额外安装 autojump

可以使用 oh-my-zsh 内置的类似组件 Z
autojump 除了名字不一样,基本雷同。

z -x 无效路径

zsh-syntax-highlighting

官网 https://github.com/zsh-users/zsh-syntax-highlighting

作用 平常用的lscd 等命令输入正确会绿色高亮显示,输入错误会显示其他的颜色。

安装

克隆项目

git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting

~/.zshrc 中配置

plugins=(其他的插件 zsh-syntax-highlighting)

使配置生效

source ~/.zshrc

zsh-autosuggestions

官网 https://github.com/zsh-users/zsh-autosuggestions

作用

效率神器 👍

如图输入命令时,会给出建议的命令(灰色部分)按键盘 → 补全

.zshrc 文件添加这句话即可。

安装

克隆项目

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

~/.zshrc 中配置

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

使配置生效

source ~/.zshrc
 0
评论(没有评论)
验证码