Use terminal Neovim as the default text editor in macOS

First, make sure your $EDITOR environment variable is set to the editor of your choice, which would be nvim in my case.

The following works with kitty, which is a terminal emulator like Terminal.app or iTerm2. When opening a text file from the Finder with kitty.app, kitty will open the file with your $EDITOR in a new window, and when you then quit the editor again, the window will close itself.

For every file type that should be opened with Neovim, select a file in the Finder and then right click -> Get Info -> Open with: kitty.app -> Change All... like so: open with kitty