--- title: description: date: 2023-04-16 lang: zh-tw tags: - 樹莓派 - Linux - --- # 樹莓派筆記-安裝 oh my zsh 原版的Terminal真的很難看 需要一個好看又好用的 且在樹莓派安裝oh my zsh的過程也是有點小問題 應此來記錄一下 ## 開始 切記樹梅派**一定要用有桌面版本**的 單純只有CLI版用不了 powerlevel10k 的 rainbow style 可以先用**桌面板**設定好再切換為**CLI** ### 前置需求 確保套件都是最新版本 ```zsh= sudo apt update && sudo apt upgrade -y ``` 安裝 zsh ```zsh= sudo apt-get install zsh -y ``` 將 zsh 設置為默認 shell ```zsh= chsh -s /bin/zsh ``` 並輸入`echo $0`確認現在使用的shell ### 安裝 #### 安裝 OhMyZsh ```zsh= sh -c "$(wget https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh -O -)" ``` #### 安裝常用插件 zsh-syntax-highlighting 提示當前輸入的命令是否正確(紅色=錯誤, 綠色=正確) ```zsh= git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting ``` zsh-autosuggestions 紀錄輸入過的所有命令,並自動匹配想要輸入的命令,按Tab補全 ```zsh= git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions ``` sudo 提示命令沒權限,按兩下Esc可在命令頭自動加上sudo #### 安裝主題: powerlevel10k ```zsh= git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k ``` #### 安裝字型: 安裝“fontconfig”包 ```zsh= sudo apt install fontconfig -y ``` 下載 Meslo Nerd字型 ```zsh= wget https://github.com/romkatv/powerlevel10k-media/raw/master/MesloLGS%20NF%20Regular.ttf ``` 在 `~/.local/share`下創建`fonts`資料夾 ```zsh= sudo mkdir -p ~/.local/share/fonts ``` * `-p` - 會一路創建沒有的資料夾 並把字型放入此資料夾 ```zsh= sudo mv "MesloLGS NF Regular.ttf" ~/.local/share/fonts ``` 手動重建字型緩存 ```zsh= fc-cache -fv ``` ## 設置 ### 設定terminal字型 先設定 terminal 字型為 Meslo Nerd > 非桌面板這步驟就無法做了 > 就會導致沒有 rainbow style ### 設定oh my zsh配置 開啟`~/.zshrc`文件 ```zsh= sudo nano ~/.zshrc ``` 找到`plugins=(git)`並更改成 ```zsh= plugins=(git zsh-autosuggestions zsh-syntax-highlighting sudo) ``` 找到``ZSH_THEME="robbyrussell"`並更改成 ```zsh= ZSH_THEME="powerlevel10k/powerlevel10k" ``` 刷新shell ```zsh= source ~/.zshrc ``` ### 設定主題 設定powerlevel10k主題 ```zsh= p10k configure ``` ## Ref: * https://github.com/ohmyzsh/ohmyzsh * https://gist.github.com/matthewjberger/7dd7e079f282f8138a9dc3b045ebefa0
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up