macvim-dev / macvim

Vim - the text editor - for macOS
https://macvim.org
Vim License
7.47k stars 680 forks source link

Support App Intents and app shortcuts #1322

Open ychin opened 1 year ago

ychin commented 1 year ago

macOS 13 Ventura added a new API called App Intents (https://developer.apple.com/documentation/appintents). MacVim should support that to allow for integration into other apps and automation.

TODO: Think about what kind of intents to expose. We already exposes 2 macOS "Services" (a pretty old API) today: one for opening MacVim in a specific folder, and another for opening MacVim from a particular selected text. We can add those two to App Intents as well.

Other than those two, some ideas for feature set:

A lot of the above can already be done with Vim's +clientserver and using mvim -c in a ZSH script. Adding dedicated shortcuts does seem nicer as it would provide an easier and more structured interfaces for stringing together commands in Shortcuts.app. But we should make sure that whatever we add does provide genuine value to the user.

In addition to app intents (which could be used to compose shortcuts), we should provide default app shortcuts that can be used as is.

Also, interestingly, it doesn't seem like a lot of apps have added support for this, and exactly 0 text editors / IDEs seem to support it.

eirnym commented 1 year ago

I love this idea!

I have following questions should be answered during the implementation.

  1. Backward compatibility. My guess, that an old system just won't read these entries.
  2. What's about services? Should we keep both? My guess is we keep services for the time being
  3. Does new AppIntents registration know where exactly to look for mvim?
  4. Does old services know where exactly to look for mvim?
  5. I wouldn't rely on the PATH variable as it can be set in a script and in some cases (like when doing sudo, su and ssh) it's not a good idea to add MacVim to the PATH.