Created
November 26, 2025 04:24
-
-
Save tkolleh/292f0fce55eef4bc2890698fe0b7085e to your computer and use it in GitHub Desktop.
Neovim Ghostty App on MacOS
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env zsh | |
| # | |
| # 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 | |
| # | |
| # Script to open files or a directory in Neovim with Ghostty. | |
| # Icons: https://www.reddit.com/r/neovim/comments/13713rq/i_made_a_neovim_icon_for_macos_download_link_in/ | |
| # | |
| # | |
| nvim_bin="/opt/homebrew/bin/nvim" | |
| shell=${SHELL:-/bin/zsh} | |
| # Use an array to build the command and its arguments | |
| local -a cmd_args | |
| cmd_args=("exec" "$nvim_bin") | |
| # If file arguments are provided, resolve them to absolute paths | |
| if [ $# -gt 0 ]; then | |
| for f in "$@"; do | |
| # Use Zsh's built-in `:A` modifier for performant path expansion. | |
| cmd_args+=("${f:A}") | |
| done | |
| fi | |
| # Use Zsh's `(q)` flag to safely quote arguments for the new shell command. | |
| open -na "Ghostty" --args -e "$shell" "-c" "exec $nvim_bin ${(q)@}" |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Create a MacOS App that opens into Neovim from Ghostty using this script.