安装oh-my-zsh时踩过的坑

1、查看本机所有shell类型

cat /etc/shells

2、查看当前shell

echo $shell

3、切换shell为zsh(mac自带zsh)

chsh -s /bin/zsh

4、安装oh-my-zsh

官方推荐

via curl

sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"

via wget

sh -c "$(wget -O- https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"

 上述官方推荐安装方式,但一般会被墙掉,此坑的解决方法是下载https://github.com/ohmyzsh/ohmyzsh到本地,进入tools文件夹,执行

./install.sh

开始出现Cloning Oh My Zsh...稍等片刻,即可完成安装。

5、自动补全插件zsh-autosuggestions

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

vim ~/.zshrc

输入键盘i,开始编辑,如果有plugins,找到并添加(若无,则随便找个位置添加)

plugins=(
  git
  zsh-autosuggestions
)

  6、高亮插件zsh-syntax-highlighting

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

vim ~/.zshrc

输入键盘i,开始编辑,如果有plugins,找到并添加(若无,则随便找个位置添加)
plugins=(
  git
  zsh-autosuggestions
  zsh-syntax-highlighting
)

 

注意:

1、高亮插件zsh-syntax-highlighting必须放到最后一个

2、插件编辑完成后,执行生效

source ~/.zshrc

3、上述执行完后,插件不能生效,此坑解决方法:在plugins后加入

# If you come from bash you might have to change your $PATH.
# export PATH=$HOME/bin:/usr/local/bin:$PATH

# Path to your oh-my-zsh installation.
export ZSH=$HOME/.oh-my-zsh

# Set name of the theme to load --- if set to "random", it will
# load a random theme each time oh-my-zsh is loaded, in which case,
# to know which specific one was loaded, run: echo $RANDOM_THEME
# See https://github.com/ohmyzsh/ohmyzsh/wiki/Themes
# ZSH_THEME="robbyrussell"
ZSH_THEME="random"

# 加入插件列表
plugins=(
  git
  zsh-autosuggestions
  zsh-syntax-highlighting
)
source $ZSH/oh-my-zsh.sh

# Set list of themes to pick from when loading at random
# Setting this variable when ZSH_THEME=random will cause zsh to load
# a theme from this variable instead of looking in $ZSH/themes/

4、主题可以设置为随机,看到自己喜欢的就固定

ZSH_THEME="random"

然后就能愉快的玩耍了!

  • 5
    点赞
  • 15
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值