edit-config command opens the Ghostty configuration file in the editor specified by your $VISUAL or $EDITOR environment variables.
Usage
Description
This command provides a quick way to edit your Ghostty configuration. It opens the default user-specific configuration file in your preferred terminal text editor. The command uses the$VISUAL environment variable first, falling back to $EDITOR if $VISUAL is not set. If neither is set, it displays an error with the configuration file path so you can open it manually.
Configuration File Locations
The command opens the default user configuration file:Linux/BSD
$XDG_CONFIG_HOME/ghostty/config(typically~/.config/ghostty/config)
macOS
Ghostty checks these locations in priority order:$XDG_CONFIG_HOME/ghostty/config(if set)~/Library/Application Support/com.mitchellh.ghostty/config~/.config/ghostty/config
Prerequisites
Setting Up Your Editor
Set one of these environment variables in your shell configuration:.bashrc / .zshrc
VISUAL vs EDITOR
$VISUAL- Used for “visual” editors (vim, emacs, etc.)$EDITOR- Used for line-based editors (ed, sed, etc.)- Ghostty prefers
$VISUALover$EDITORif both are set
Examples
Basic Usage
Set Editor and Open Config
One-Time Editor Override
Create Config If Missing
Error Messages
Editor Not Set
Error
$EDITOR or $VISUAL in your shell configuration.
Editor Execution Failed
Error
$PATH and is executable.
Platform Support
Linux/BSD/macOS
Fully supported using theexec system call to launch your editor.
Windows
Windows Error
Workflow
Typical Edit Session
- Run
ghostty +edit-config - Make your changes in the editor
- Save and quit the editor
- Reload Ghostty configuration:
- Press your reload keybind (e.g.,
super+shift+,) - Or restart Ghostty
- Press your reload keybind (e.g.,
Validate After Editing
Edit and Test Workflow
Script
Tips
Related Configuration
Auto-Reload (Future)
Ghostty plans to support automatic configuration reloading in the future. Until then, manual reload is required after editing.Config File Watching
You can set up external file watching to automatically reload:Using fswatch
Notes
The command uses the POSIX
exec system call on Unix-like systems, which replaces the current process with the editor. This is why the command doesn’t return until you exit the editor.If you have multiple Ghostty configuration files (via includes or conditional configs), this command only opens the main default configuration file, not included files.
See Also
- show-config - Display current configuration
- validate-config - Validate configuration file
- Configuration Reference
- Configuration Files