WSLのシェルをbashからzshに乗り換えてみたので、その手順と感想
1.zshをインストール
まずはzshをインストール
sudo apt install zsh
2.oh-my-zshをインストール
公式通りにインストール https://github.com/robbyrussell/oh-my-zsh
curl -L https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh | sh
3.zsh-completionsをインストール
こちらはgithubから公式通りにインストールする https://github.com/zsh-users/zsh-completions
git clone https://github.com/zsh-users/zsh-completions ~/.oh-my-zsh/custom/plugins/zsh-completions
zsh-completionsをzshが読み込むよう、.zshrcに以下を記述
.zshrc
plugins=(… zsh-completions)
autoload -U compinit && compinit
4.ログインシェルをzshに変更
which zsh
でzshのパスを取得し、それをコピー(多分/usr/bin/zsh
と出るからそれをコピー)
次にchshと入力。すると、
Password:
Changing the login shell for <username>
Enter the new value, or press ENTER for the default
Login Shell [/bin/bash]:
と出てくるので、先ほどコピーしたパスを入力。もう一度WSLを立ち上げると、シェルがzshになってる
まとめ
bashからzshに移行した途端WSLの使い勝手がすごく増したので、WSLを使っている方は迷うことなくはやくzshに乗り換えたほうがいい!