UbuntuにZshをインストール
sudoできる一般ユーザーで作業する想定です。
sudo apt-get updatesudo apt-get install zsh -yzsh --version # zsh 5.9 (x86_64-ubuntu-linux-gnu)デフォルトのシェルを Zsh に変更
chshでログインシェルを変更します(反映は再ログイン後、または新しいログインセッション開始後)。
chsh -s "$(command -v zsh)"Oh My Zsh
Oh My Zsh is an open source, community-driven framework for managing your zsh configuration.
Zsh をより使いやすくするために Oh My Zsh をインストールします。
sudo apt-get install curl git -yRUNZSH=no CHSH=no KEEP_ZSHRC=yes sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" "" --unattendedプラグインを追加
自動補完とハイライトのプラグインを追加します。
git clone https://github.com/zsh-users/zsh-autosuggestions "${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}"/plugins/zsh-autosuggestionsgit clone https://github.com/zsh-users/zsh-syntax-highlighting.git "${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}"/plugins/zsh-syntax-highlightingsed -i 's/^plugins=.*/plugins=(git zsh-autosuggestions zsh-syntax-highlighting)/' ~/.zshrcsource ~/.zshrcテーマを変更
使用可能なテーマはhttps://github.com/ohmyzsh/ohmyzsh/wiki/Themes
ここではterminalpartyに変更します。
sed -i 's/^ZSH_THEME=.*/ZSH_THEME="terminalparty"/' ~/.zshrcsource ~/.zshrcテーマを Powerlevel10k に変更
見た目を整えるには手元のターミナルに Nerd Font 等が必要になることがあります(私はMoralerspace Radonを使用しています)。
git clone --depth=1 https://github.com/romkatv/powerlevel10k.git "${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}"/themes/powerlevel10ksed -i 's/^ZSH_THEME=.*/ZSH_THEME="powerlevel10k\/powerlevel10k"/' ~/.zshrc再ログインして対話形式で設定を行います。p10k configureコマンドでも設定を行うことが可能です。