"Open With" Neovim + Ghostty
Automator script used as an "Application" to open files in Neovim via Ghostty on macOS.
neovim cli
The following Automator script allows you to create an application that you can assign in MacOS to “Open With” and have it automatically open files in Neovim/Ghostty.
From: https://github.com/ghostty-org/ghostty/discussions/6001
“You can even set the icon afterwards. I use the one uploaded here”:
https://www.reddit.com/r/neovim/comments/13713rq/i_made_a_neovim_icon_for_macos_download_link_in/
#!/bin/bash
# Create a new Automator script (Application Type)
# Run Shell Script step
# Set "Pass input" to "as arguments"
# Paste this into the script
# You can now open nvim directory, or specific files with it
nvim_bin="/opt/homebrew/bin/nvim"
shell=${SHELL:-/bin/zsh}
if [ $# -eq 0 ]; then
# No file → open plain Neovim
open -na "Ghostty" --args -e "$shell" "-c" "exec \"$nvim_bin\""
else
# Build explicit command string like the hardcoded one
cmd="exec \"$nvim_bin\""
for f in "$@"; do
abs=$(realpath "$f")
cmd+=" \"${abs}\""
done
open -na "Ghostty" --args -e "$shell" "-c" "$cmd"
fi