# 把 Ubuntu 的 Terminal 變漂漂
###### tags: `ubuntu`
[TOC]
## zsh
- `echo $0` 或 `echo $SHELL` 可以看自己用什麼 shell
- 預設應該是 `bash`
- `cat /etc/shells` 可以看所有可用的 shell
- 載 zsh
- `sudo apt install zsh`
- 確認有沒有載到
- `zsh --version`
- 把預設改成 zsh
- `chsh -s /bin/zsh`
- 登出再登入 or 重開機
- 回來打開 Terminal 會有以下提示
- 按 2,它會幫你放預設的 `~/.zshrc`
```
This is the Z Shell configuration function for new users,
zsh-newuser-install.
You are seeing this message because you have no zsh startup files
(the files .zshenv, .zprofile, .zshrc, .zlogin in the directory
~). This function can help you with a few settings that should
make your use of the shell easier.
You can:
(q) Quit and do nothing. The function will be run again next time.
(0) Exit, creating the file ~/.zshrc containing just a comment.
That will prevent this function being run again.
(1) Continue to the main menu.
(2) Populate your ~/.zshrc with the configuration recommended
by the system administrator and exit (you will need to edit
the file by hand, if so desired).
--- Type one of the keys in parentheses ---
```
## Oh my zsh
- 下載 [oh my zsh](https://github.com/ohmyzsh/ohmyzsh)
- `sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"`
- 沒 `curl` 或 `git` 就自己補一下
## powerlevel10k
- 下載 [powerlevel10k](https://github.com/romkatv/powerlevel10k#meslo-nerd-font-patched-for-powerlevel10k)
- 目前的版本它叫我先載字體,反正就照 README 上的弄
- `mkdir .fonts`
- 下載推薦字體至裡面 `cd .fonts`
- `wget https://github.com/romkatv/powerlevel10k-media/raw/master/MesloLGS%20NF%20Regular.ttf`
- `wget https://github.com/romkatv/powerlevel10k-media/raw/master/MesloLGS%20NF%20Bold.ttf`
- `wget https://github.com/romkatv/powerlevel10k-media/raw/master/MesloLGS%20NF%20Italic.ttf`
- `wget https://github.com/romkatv/powerlevel10k-media/raw/master/MesloLGS%20NF%20Bold%20Italic.ttf`
- `fc-cache -fv` 把字體載入
- `sudo apt install fontconfig`
- `git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k`
- `sudo apt install gnome-tweaks` GUI 改一些設定
- 打開 Tweaks $\to$ Fonts $\to$ Monospace Text $\to$ MeslosLGS NF Regular
- 修改 `~/.zshrc`
- `ZSH_THEME=` 後面的部份改成 `powerlevel10k/powerlevel10k`
- 重開 Terminal
- 前幾個選項顯示正常的話 歐耶完成
## Dracula
- `sudo apt-get install dconf-cli`
- `git clone https://github.com/dracula/gnome-terminal`
- `cd gnome-terminal`
- 進 Preference 開一個新 Profile
- 執行 gnome-terminal 裡的 `install.sh`
- 把該 profile 設為預設
- 順便很給掰的把背景設一點點透明度
## Plugins
- zsh-autosuggestions
- `git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions`
- zsh-syntax-higlighting
- `git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting`
- `~/.zshrc` 中找到 `plugins`
- 改成 `plugins=(git zsh-autosuggestions zsh-syntax-highlighting)`
## VSCode
- 進到`settings.json`
- 加上 `"terminal.integrated.shell.osx": "/bin/zsh",` 和 `"terminal.integrated.fontFamily": "MesloLGS NF"`
- 重開 vscode
讚啦
## 參考來源
{%youtube PZTLIVQxxEY %}
- [Make your Linux Terminal Productive & Beautiful.](https://dev.to/yogeshdev/make-your-unix-terminal-beautiful-productive-c1d)
- [Setup Zsh + Oh my Zsh + Powerlevel10k + Dracula theme with auto-suggestions and syntax-higlighting](https://medium.com/@satriajanaka09/setup-zsh-oh-my-zsh-powerlevel10k-on-ubuntu-20-04-c4a4052508fd)
- [在VSCode 裝個漂亮的 Terminal 介面- zsh + powerlevel10k](https://sasacode.wordpress.com/2021/06/18/%E5%9C%A8vscode-%E8%A3%9D%E5%80%8B%E6%BC%82%E4%BA%AE%E7%9A%84-terminal-%E4%BB%8B%E9%9D%A2-zsh-powerlevel10k/)