Raspberry Pi 安装 oh-my-zsh

1. 为什么要安装oh-my-zsh:

使用Raspberry Pi 有几天了,默认的terminal使用不太爽,一方面不太好看,还有提示补全功能十分呆滞。网上搜索一下如何美化,发现可以oh-my-zsh,尝试安装一下。

2. 安装:

2.1. 安装oh-my-zsh

  1. 更新 Raspberry Pi
sudo apt-get update && sudo apt-get upgrade
  1. 安装zsh

如果没有安装git,需要先安装git

sudo apt-get install zsh
  1. 将zsh设置为默认shell
chsh -s /bin/zsh
Password:

需要输入密码

  1. 安装oh-my-zsh
$ sh -c“ $(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)”

2.2. oh-my-zsh插件

常用插件:

zsh-syntax-highlighting :提供了语法高亮显示。

zsh-autosuggestions :它会根据历史记录和完成情况建议您键入的命令,而且快速/不干扰自动提示。

zsh-completions :命令自动补全。

插件安装:

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

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

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

2.3. 修改配置(.zshrc)

  1. 取消第二行的注释
# export PATH=$HOME/bin:/usr/local/bin:$PATH

改为

export PATH=$HOME/bin:/usr/local/bin:$PATH
  1. 设置插件

修改

plugins=(git)

改为

扫描二维码关注公众号,回复: 11280971 查看本文章
plugins=(git zsh-completions zsh-autosuggestions zsh-syntax-highlighting)
autoload -U compinit && compinit
  1. 保存,重启

2.4. oh-my-zsh主题

oh-my-zsh 有丰富的主题可供选择。可以在 官网主题页中挑选喜欢的主题。我选择的是:agnoster

  1. 安装agnoster主题所需字体
sudo apt-get install fonts-powerline
  1. 设置主题

使用vim ~/.zshrc命令打开文件,修改文件中ZSH_THEME的值:

ZSH_THEME="agnoster"
  1. 保存,重启

3. 参考:

https://www.uberbuilder.com/oh-my-zsh-on-raspberry-pi/
https://ohmyz.sh/

猜你喜欢

转载自www.cnblogs.com/xgo0104/p/12974871.html