- Install neovim:
brew install neovim
- Install neovim-remote:
pip3 install neovim-remote
- In iTerm2, go to Preferences -> Profiles -> Advanced, select Semantic History -> Run coprocess, and paste this in:
n=/usr/local/bin/nvr; s="$n --serverlist | tail -n1"; c="$n --servername `$s` --remote-silent"; [ -z "\2" ] && $c \1 || $c +\2 \1
Then command-click a filepath (with optional line number) in iTerm to open the file. Neovim must already be open, and the most recently opened running instance will be used.
You can also achieve this with macvim, but only neovim works in the terminal.