Skip to content

Instantly share code, notes, and snippets.

@tkolleh
Created November 26, 2025 04:24
Show Gist options
  • Select an option

  • Save tkolleh/292f0fce55eef4bc2890698fe0b7085e to your computer and use it in GitHub Desktop.

Select an option

Save tkolleh/292f0fce55eef4bc2890698fe0b7085e to your computer and use it in GitHub Desktop.
Neovim Ghostty App on MacOS
#!/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)@}"
@tkolleh
Copy link
Author

tkolleh commented Nov 26, 2025

Create a MacOS App that opens into Neovim from Ghostty using this script.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment