安装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"

然后就能愉快的玩耍了!

你可能感兴趣的:(linux)