Files
Obsidian-Main/21.01. OS/21.01. Linux/oh-my-zsh.md
Awin Huang 61cefc53fd vault backup: 2025-08-18 12:04:08
Affected files:
21.01. OS/21.01. Linux/oh-my-zsh.md
2025-08-18 12:04:08 +08:00

2.2 KiB
Raw Blame History

tags, aliases, date, time, description
tags aliases date time description
2025-08-18 11:56:38

安裝必要的套件

sudo apt install wget git curl vim -y

安裝 Patched 字型

Nerd font 安裝你喜歡的字型。 記得將 terminal 的字型更改為你剛剛安裝的字型。

安裝 Zsh

shell 輸入

sudo apt install zsh -y

安裝 Oh My Zsh

輸入以下指令安裝 Oh My Zsh安裝完畢後按下 Enter 同意把預設 Shell 換成 Zsh。

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

設定預設 Shell

若之前並沒有成功設定修改預設 Shell請執行以下指令:

chsh -s $(which zsh)

執行 zsh 開始使用

zsh

安裝插件

安裝以下插件的時候,
請確定已安裝好 Oh My Zsh ,且目前正在使用的 Shell 是 Zsh。

主題 PowerLevel10k

git clone https://github.com/romkatv/powerlevel10k.git $ZSH_CUSTOM/themes/powerlevel10k

插件 zsh-autosuggestions

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

插件 zsh-syntax-highlighting

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

啟動插件

vi ~/.zshrc

點擊 i ,進入編輯模式。

  1. 修改主題

    1. ZSH_THEME="powerlevel10k/powerlevel10k"
  2. 新增要啟動的插件 (Plugins)

    1. plugins=(git zsh-autosuggestions zsh-syntax-highlighting zsh-z)
    2. 點擊 ESC 跳出編輯模式。
    3. 輸入 :wq 儲存。
  3. 應用修改過的 zshrc

source ~/.zshrc

應用修改之後,因為第一次使用 Powerlevel10k會自動啟動設定,按造需求完成設定即可

參考來源