0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Ghosttyのtab-inherit-working-directory/split-inherit-working-directoryの効かない問題

0
Posted at

概要

GhosttyのV1.3.0のアップデートでtab-inherit-working-directorysplit-inherit-working-directoryの設定が追加されました。

Release Note

tab-inherit-working-directory はタブ分割時にフォーカスしていた作業ディレクトリを継承します。split-inherit-working-directory はペイン分割時に作業ディレクトリを継承します。

ドキュメント

しかし、これらの設定をtrueに指定しても機能が有効化されませんでした。

解決策

~/.bashrc に以下のスクリプトを追加することで解決しました。

if [ -n "${GHOSTTY_RESOURCES_DIR}" ]; then
    builtin source "${GHOSTTY_RESOURCES_DIR}/shell-integration/bash/ghostty.bash"
fi

公式ドキュメントの「Manual Shell Integration Setup」セクションに該当情報が記載されています。

Shell Integration - Ghostty

原因

Macでbashを使っていたことが原因でした。以下Cluadeの解説です。

tab-inherit-working-directory などの設定は、内部的に OSC 7 というエスケープシーケンスに依存しています。OSC 7はシェルがカレントディレクトリをターミナルに通知する仕組みで、Ghosttyのシェルインテグレーションを有効にすることで機能します。
Ghosttyは通常、シェルインテグレーションを自動で注入しますが、macOSにプリインストールされているBashはバージョン3.2(2007年リリース)と非常に古く、自動インジェクションに対応していません。これはAppleがBash 4.0以降で採用された GPLv3ライセンスを同梱したくないという理由で、意図的に古いバージョンのまま据え置いているためです。
なお、macOS Catalina以降のデフォルトシェルはzshであり、zshであれば自動でシェルインテグレーションが機能するため、この問題は発生しません。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?