## 経緯 [[Windows 11]]と[[Windows Terminal]]環境にて、[[oh-my-posh]]で満足する環境は構築できている。 だが、[[WSL2]]は[[Starship]]を使っており、テーマカスタマイズもかなりしやすかったので、[[Starship]]に統一できるなら統一してみたい。 ということでチャレンジしてみる。 ## [[oh-my-posh]]の無効化 [[Microsoft.PowerShell_profile.ps1]]の以下をコメントアウト ```powershell oh-my-posh init pwsh --config ~/.oh-my-posh.json | Invoke-Expression ``` ## [[Starship]]のインストール 公式のトップページから。 <div class="link-card"> <div class="link-card-header"> <img src="https://starship.rs/icon.png" class="link-card-site-icon"/> <span class="link-card-site-name">starship.rs</span> </div> <div class="link-card-body"> <div class="link-card-content"> <div> <p class="link-card-title">Starship: Cross-Shell Prompt</p> </div> <div class="link-card-description"> Starship is the minimal, blazing fast, and extremely customizable prompt for any shell! Shows the in... </div> </div> <img src="https://starship.rs/icon.png" class="link-card-image" /> </div> <a href="https://starship.rs/"></a> </div> 上記にはなかったが[[Scoop]]でインストールできた。 ```console $ scoop install starship Installing 'starship' (1.16.0) [64bit] from main bucket starship-x86_64-pc-windows-msvc.zip (3.1 MB) [===================================================================================================================] 100% Checking hash of starship-x86_64-pc-windows-msvc.zip ... ok. Extracting starship-x86_64-pc-windows-msvc.zip ... done. Linking ~\scoop\apps\starship\current => ~\scoop\apps\starship\1.16.0 Creating shim for 'starship'. 'starship' (1.16.0) was installed successfully! Notes ----- Usage: Add 'Invoke-Expression (&starship init powershell)' to the end of your PowerShell $PROFILE. Prerequisites: A Powerline font installed and enabled in your terminal. 'starship' suggests installing 'extras/vcredist2022'. ``` [[Microsoft.PowerShell_profile.ps1]]の最後に以下を追加。 ```powershell #----------------------------------------------------- # Starship #----------------------------------------------------- Invoke-Expression (&starship init powershell) ``` これで次に開くと表示が切り替わる。 > [!positive] 今のところ速度の劣化は感じない。逆に目に見えて速くなっているわけでもない。[[Git]]の情報はデフォルトだと少な目のため、それ次第か。 ## 設定の変更 設定をカスタマイズする。まずは設定ファイルの場所を確認。 <div class="link-card"> <div class="link-card-header"> <img src="https://starship.rs/icon.png" class="link-card-site-icon"/> <span class="link-card-site-name">starship.rs</span> </div> <div class="link-card-body"> <div class="link-card-content"> <div> <p class="link-card-title">Starship: Cross-Shell Prompt</p> </div> <div class="link-card-description"> Starship is the minimal, blazing fast, and extremely customizable prompt for any shell! Shows the in... </div> </div> <img src="https://starship.rs/icon.png" class="link-card-image" /> </div> <a href="https://starship.rs/config/"></a> </div> `~/.config/starship.toml` でOK。[[WSL2]]の[[Ubuntu]]で設定したものがそのまま利用できた。 > [!positive] これは[[PowerShell]]と[[Bash]]が同じ設定ファイルを利用できることを意味するのでは...!! かなりアツイ!! あとは[[📜Starshipのプロンプトをカスタマイズ]] すれば、[[Windows]]でも[[Ubuntu]]でも恩恵を得られそうなので、カスタマイズをしていけばよい。