How to change editor to vim in mac os?

I sorted this on MacOS Sonoma 14, Joplin 3.0.15 (prod, darwin).

  1. created a script joplin-vim-external.sh
  2. made it executable with chmod +x joplin-vim-external.sh
  3. provided absolute path to this file in Joplin "Path". Left "Arguments" empty.

Contents of the script:

#!/bin/bash
osascript <<EOF
tell application "Terminal"
    do script "vim '$1'"
    activate
end tell
EOF