效果图

image-20230102180945456

先决条件

  1. 系统已安装git,没有可以使用以下命令安装

    1
    sudo apt install git
  2. 除了安装zsh和git需要root权限,其他都请不要root权限运行

安装zsh

  1. 使用apt安装

    1
    sudo apt install zsh
  2. 使用命令zsh --version校验zsh是否安装成功

    1
    2
    ❯ zsh --version
    zsh 5.8.1 (x86_64-ubuntu-linux-gnu)
  3. 将zsh设置为默认shell(无需root权限):

    1
    chsh -s $(which zsh)

安装oh my zsh

  1. 使用curl命令下载并安装

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

安装自动提示插件

  1. 使用git clone命令将zsh-autosuggestions 插件克隆到 oh-my-zsh 插件目录中:

    1
    git clone https://github.com/zsh-users/zsh-autosuggestions ~/.oh-my-zsh/custom/plugins/zsh-autosuggestions
  2. 打开配置文件 ~/.zshrc,并在 plugins 行的末尾添加 zsh-autosuggestions

    1
    plugins=(... zsh-autosuggestions)
  3. 保存文件并退出

  4. 使用以下命令重新加载配置文件:

    1
    source ~/.zshrc

安装powerlevel10k主题

  1. 使用git clone命令将主题下载到oh-my-zsh主题目录中:

    1
    git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ~/.oh-my-zsh/custom/themes/powerlevel10k
  2. 打开配置文件~/.zshrc,将oh-my-zsh主题设置为powerleve10k

    1
    ZSH_THEME="powerlevel10k/powerlevel10k"
  3. 使用以下命令重新加载~/.zshrc

    1
    source ~/.zshrc
  4. 设置成功后会进入自定义配置界面。根据需求自行设置即可

  5. 日后也可以用p10k configure命令重新配置主题样式