From 61cefc53fd69ad3162d1081dd969b5897a451946 Mon Sep 17 00:00:00 2001 From: Awin Huang Date: Mon, 18 Aug 2025 12:04:08 +0800 Subject: [PATCH] vault backup: 2025-08-18 12:04:08 Affected files: 21.01. OS/21.01. Linux/oh-my-zsh.md --- 21.01. OS/21.01. Linux/oh-my-zsh.md | 99 +++++++++++++++++++++++++++++ 1 file changed, 99 insertions(+) create mode 100644 21.01. OS/21.01. Linux/oh-my-zsh.md diff --git a/21.01. OS/21.01. Linux/oh-my-zsh.md b/21.01. OS/21.01. Linux/oh-my-zsh.md new file mode 100644 index 0000000..2ec43fe --- /dev/null +++ b/21.01. OS/21.01. Linux/oh-my-zsh.md @@ -0,0 +1,99 @@ +--- +tags: +aliases: +date: 2025-08-18 +time: 11:56:38 +description: +--- + +## 安裝必要的套件 + +```shell +sudo apt install wget git curl vim -y +``` + + +## 安裝 Patched 字型 +到 [Nerd font](https://www.nerdfonts.com/) 安裝你喜歡的字型。 +記得將 terminal 的字型更改為你剛剛安裝的字型。 + + +## 安裝 Zsh + +shell 輸入 + +```shell +sudo apt install zsh -y +``` + +## 安裝 Oh My Zsh + +輸入以下指令安裝 Oh My Zsh,安裝完畢後,按下 Enter 同意把預設 Shell 換成 Zsh。 + +```shell +sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" +``` + +### 設定預設 Shell + +若之前並沒有成功設定修改預設 Shell,請執行以下指令: + +```shell +chsh -s $(which zsh) +``` + +執行 zsh 開始使用 + +```shell +zsh +``` + +## 安裝插件 + +安裝以下插件的時候, +請確定已安裝好 Oh My Zsh ,且目前正在使用的 Shell 是 Zsh。 + +### 主題 [PowerLevel10k](https://github.com/romkatv/powerlevel10k) + +```shell +git clone https://github.com/romkatv/powerlevel10k.git $ZSH_CUSTOM/themes/powerlevel10k +``` + +### 插件 [zsh-autosuggestions](https://github.com/zsh-users/zsh-autosuggestions) + +```shell +git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions +``` + +### 插件 [zsh-syntax-highlighting](https://github.com/zsh-users/zsh-syntax-highlighting) + +```shell +git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting +``` + +## 啟動插件 + +```shell +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 +```shell +source ~/.zshrc +``` + +應用修改之後,因為第一次使用 Powerlevel10k,**會自動啟動設定,按造需求完成設定即可**。 + + +# 參考來源 +- [Ubuntu 安裝 Zsh + Oh My Zsh + Powerlevel10k 與各種插件 | 成功他媽.阿瑋](https://www.kwchang0831.dev/dev-env/ubuntu/oh-my-zsh) \ No newline at end of file