A MailMate bundle that lets you edit email drafts in Neovim, launched inside Ghostty.
This bundle provides a single feature: it allows you to use Neovim inside Ghostty to compose new messages or reply to emails in MailMate. I built this bundle with some help from ChatGPT and Claude.
It adds a command to MailMate’s “Commands” menu that opens the message you’re composing or replying to in Neovim, launched inside Ghostty. Once you save and quit Neovim, the changes are synced back to MailMate automatically.
To install the bundle:
- Go to the Releases page and download the
neovim-ghostty.mmBundle.zipfile. - Unzip the file to get a folder named
neovim-ghostty.mmBundle. - Move the
neovim-ghostty.mmBundlefolder to the MailMate Bundles directory:~/Library/Application Support/MailMate/Bundles/. - Restart MailMate. You should now see a new option under the
Commandsmenu:Neovim (in Ghostty) > Edit.
To remove the bundle:
- Delete the bundle from
~/Library/Application Support/MailMate/Bundles/ - Quit MailMate.
- Delete the following files from
~/Library/Caches/com.freron.MailMate/:BundlesIndex.binaryCache.dbCache.db-shmCache.db-wal
- Relaunch MailMate. The command
Neovim (in Ghostty) > Editshould now be gone.
Note: These steps only apply to bundles you manually install in ~/Library/Application Support/MailMate/Bundles/.
I learned this process from Benny Kjær Nielsen, the creator of MailMate. If you have further questions about MailMate bundles, I recommend reaching out to him directly, searching the MailMate mailing list archives, or posting a question on the mailing list.
You can use this bundle to edit both new messages and replies.
- Create a new message in MailMate.
- Choose
Commands > Neovim (in Ghostty) > Editfrom the menu bar, or press the keyboard shortcut "Shift + Control + O". - A new Ghostty terminal instance will open, launching Neovim with the email body loaded. This is a separate instance and won’t interfere with any existing Ghostty sessions you might have open.
- After editing, use
:wqto save and quit. The email body in MailMate will be updated automatically.
- Select a message and choose
Message > Reply.... - When the MailMate composer opens, go to
Commands > Neovim (in Ghostty) > Edit, or use the keyboard shortcut. - Follow the same editing process as above.
Instead of choosing the menu command manually, you can press: Shift + Control + O
This opens the current draft or reply in Neovim inside Ghostty.
This bundle uses a shell script (Support/bin/edit) to launch Neovim inside Ghostty.
The script locates the nvim executable using the PATH environment variable.
On macOS, GUI applications like MailMate do not normally inherit your full shell environment. To work around this, the script manually appends common binary paths to PATH at runtime:
/usr/local/bin(Homebrew on Intel Macs)/opt/homebrew/bin(Homebrew on Apple Silicon Macs)$HOME/bin(for manual installs)
If the brew command is available, the script also adds $(brew --prefix)/bin to PATH.
This ensures compatibility with non-default Homebrew installations that may use a custom prefix.
If nvim is installed in a different location that isn’t covered by these, the script will not find it and will exit with an error.
In that case, you can either:
- Add the appropriate path to your
PATHenvironment variable, or - Modify
Support/bin/editto manually set thenvimpath
Also make sure Ghostty is installed and accessible via /usr/bin/open -na "Ghostty".
Starting with Ghostty 1.2.0, commands launched through the -e flag are executed directly rather than being wrapped with /bin/sh. This update changes how command arguments are processed internally and slightly adjusts how terminal commands are invoked on macOS.
To accommodate this change, this bundle now uses a small, short-lived wrapper script created in the system’s temporary directory. The wrapper launches Neovim with the correct file path and deletes itself once Neovim exits.
This approach ensures that Neovim always launches reliably inside Ghostty on Ghostty 1.2.0 and later, while maintaining compatibility with earlier versions.