
- contains `.elv` file that implements the core of Elvish integration. - does not contain routines needed for automatic integration. - stored in `./elvish/lib/...` in preparation for automatic integration: Elvish imports `.../elvish/lib/*.elv`. checklist: - no confirmation on close where the cursor is at prompt: works, only occasionally doesn't, I'm not yet sure when. - new terminals start in pwd of previously focused terminal: works - prompts resize correctly: works - triple-click while holding `ctrl` selects output of a command: works (when mouse is over the output) - cursor at the prompt is turned into a bar: works - ghostty:`jump_to_prompt` scrolls through prompts: works - `opt`-click moves cursor at the prompt: works - `sudo` preserves ghostty terminfo: untested - not sure when this is needed exactly, but did not encounter any errors after sudo, either
Shell Integration Code
This is the shell-specific shell-integration code that is used for the shell-integration feature set that Ghostty supports.
This README is meant as developer documentation and not as user documentation. For user documentation, see the main README.
Implementation Details
Bash
Automatic Bash shell integration works by
starting Bash in POSIX mode and using the ENV
environment variable to load
our integration script (bash/ghostty.bash
). This prevents Bash from loading
its normal startup files, which becomes our script's responsibility (along with
disabling POSIX mode).
Bash shell integration can also be sourced manually from bash/ghostty.bash
.
Fish
For Fish, Ghostty prepends to the
XDG_DATA_DIRS
directory. Fish automatically loads configuration
files in <XDG_DATA_DIR>/fish/vendor_conf.d/*.fish
on startup,
allowing us to automatically integrate with the shell. For details
on the Fish startup process, see the
Fish documentation.
Zsh
For zsh
, Ghostty sets ZDOTDIR
so that it loads our configuration
from the zsh
directory. The existing ZDOTDIR
is retained so that
after loading the Ghostty shell integration the normal Zsh loading
sequence occurs.