GhosttyからリモートのLinuxへSSHした際、プロンプトの色などが正しく表示されない問題を解決する
Ghosttyで開始したシェルから別のLinuxサーバへSSHしたところ、プロンプトの色が正しく表示されませんでした。Terminfoには以下の記載がありました。
Ghostty's terminfo entry is available in ncurses 6.5-20241228 and above. As distros update their ncurses packages, Ghostty's terminfo entry will be available by default system-wide. This will take time to propagate.
確かに、デフォルト状態のGhosttyはTERM環境変数として(xterm-256colorなどではなく)xterm-ghosttyという文字列を送信していました。これを回避する手段として同ページに以下の記載がありました。
Both variants can be automated by specifying one or both of the following in your Ghostty configuration:
- shell-integration-features = ssh-terminfo to copy the terminfo entry the first time you log into a new server over SSH.
- shell-integration-features = ssh-env to configure SSH to fall back to xterm-256color.