背景
Windows OSを最近クリーンインストールしたので、WSLのシェルをいい感じにしたい。 前世ではpreztoを使っていたので、使用感をあまり変えずに流行りの(?)zinit使いたい。 そんな感じの作業ログをお届けします。
やったこと
1. zshのインストール&デフォルトのシェル変更
sudo apt install zsh
chsh -s /usr/bin/zsh
2. zinitのインストール
以下、世界はzshです。
bash -c "$(curl --fail --show-error --silent --location https://raw.githubusercontent.com/zdharma-continuum/zinit/HEAD/scripts/install.sh)" zinit self-update
(https://github.com/zdharma-continuum/zinit 参照)
3. いい感じのプラグインを入れる
a. powerlevel10k
以下に従って ~/.zshrcに zinit ice depth=1; zinit light romkatv/powerlevel10k を追記して、 source ~/.zshrc
https://github.com/romkatv/powerlevel10k?tab=readme-ov-file#zinit
すると、interactiveなconfigure画面に入るので、設定する。
(powerlevel10k configure と入力するといつでも再設定できる)
b. その他プラグインを入れる(雑)
.zshrcに下記を追記した
# zinit plugins
zinit light zsh-users/zsh-syntax-highlighting
zinit light zsh-users/zsh-autosuggestions
zinit light zsh-users/zsh-completions
zinit snippet PZTM::completion
zinit snippet PZTM::directory
PZTM::<モジュール名>はpreztoのrepoのmodule以下の init.zshを参照するための特殊な構文。
元々使っていた補完の使用感と合わせるために、ひとまず completionと directoryだけ持ってきた。
一応構文についても解説しておく。(少し調べた程度なのであまり自信はない)
zinit light <GitHubのrepo> でloadできる。
初回時はcloneもしてくれる。
zinit snippet <ファイルのurl> とすると、curl的なのでそのファイルをダウンロードして、実行する。
c. エイリアス
Ubuntuのデフォルトのbashに入ってるエイリアス群を .zshrcに追加。
ll とか手癖で打っちゃうので入れておくに越したことないかな。
その他エイリアスは困り次第追加する予定。
alias egrep='egrep --color=auto' alias fgrep='fgrep --color=auto' alias grep='grep --color=auto' alias l='ls -CF' alias la='ls -A' alias ll='ls -alF' alias ls='ls --color=auto'