如何在Mac上快速安装oh-my-zsh&zsh-autosuggestion[国内镜像源-极速]

21 篇文章 0 订阅
5 篇文章 0 订阅

1、官方资源和github地址信息

ohmyzsh-github

2、安装方法

2.1 mac自带了zsh,需要更新

brew install zsh zsh-completions

在这里插入图片描述

2.2 set up zsh as default(把zsh设置成默认shell)

#设置
chsh -s $(which zsh)
#查检-需要关闭终端重新打开后生效
echo $SHELL

2.3 安装 oh my zsh

这里需要注意zsh是安装oh my zsh 的Prerequisites(前置条件

2.3.1 下载oh my zsh到~/.oh-my-zsh

1、通过curl方式安装:
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
2、通过wget方式安装
sh -c "$(wget -O- https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"

以上两个方式都是很慢的安装方式
这是使用git方式clone下载安装的,这里github下载也很慢,有个好办法,通过gitee安装

先将github项目导入自己的gitee仓库-ohmyzsh.git,然后再clone国内仓库速度飞快,或者你自己重新同步。

git clone https://gitee.com/null_454_5218/ohmyzsh.git ~/.oh-my-zsh

在这里插入图片描述
在这里插入图片描述

2.3.2 zshrc的配置信息【来自模板】

vi ~/.zshrc
#内容从这个模板来
/Users/honglei/.oh-my-zsh/templates/zshrc.zsh-template
#记得最后
source ~/.zshrc 

在这里插入图片描述

2.4 安装 oh my zsh的plugins

2.4.1下载插件到/.oh-my-zsh/custom目录中

git clone https://gitee.com/null_454_5218/zsh-autosuggestions.git $ZSH_CUSTOM/plugins/zsh-autosuggestions

2.4.2 配置文件中,添加支持的插件

For example, this might begin to look like this:

plugins=(
  git
  zsh-autosuggestions
  bundler
  dotenv
  osx
  rake
  rbenv
  ruby
)

在这里插入图片描述

2.4.3 使用帮助

As you type commands, you will see a completion offered after the cursor in a muted gray color. This color can be changed by setting the ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE variable. See configuration.
键入命令时,您会在光标后看到灰色的静音形式的补全。 可以通过设置ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE变量来更改此颜色。 请参阅配置。

If you press the → key (forward-char widget) or End (end-of-line widget) with the cursor at the end of the buffer, it will accept the suggestion, replacing the contents of the command line buffer with the suggestion.
如果在光标位于缓冲区末尾的位置按→键(前向字符小部件)或End(行尾小部件),它将接受建议,并用建议替换命令行缓冲区的内容。

If you invoke the forward-word widget, it will partially accept the suggestion up to the point that the cursor moves to.
如果您调用前向小部件,它将一直接受建议直到光标移动到的位置。

3、查看效果

在这里插入图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

[shenhonglei]

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值