terrychou / iVim

A vim port to iOS.
601 stars 34 forks source link

URL scheme support #200

Closed jakub-stastny closed 2 years ago

jakub-stastny commented 3 years ago

Hey,

I don't know whether it's just me missing something, but I read the manual and searched the GH issues and I can't find any info about whether iVim supports iOS URLs?

What I mean is I'd like to open URL say ivim://my-documents/my-document.txt for instance via a notification. I have a scheduled notification in Scriptable, which when I tap can execute a URL and that URL is meant to open iVim with a predetermined document.

The document is already in iVim directory, I'm not importing anything from outside.

Is there no such thing or is it just me?

Alternatively is there any other way to achieve similar results? I tried in Shortcuts Run Ex Command, I created a new command in my ~/.vimrc: command OpenJournal cd ~/hyperlinks/journal | edit journal.org, but the shortcut only displays success and exits, I suppose it's meant for non-interactive things(?)

Thank you for any advice 🙏🏼

terrychou commented 3 years ago

Unfortunately, no, iVim right now does not support URL schemes as you described above. And due to the Shortcuts's 10 seconds limitation, the iVim's actions will run in background and then go back to Shortcuts.

However, I think there is a solution to your requirement. Although iVim jumps back to Shortcuts right after running the command, it usually still stays in the background. So you can use the action Open App to open iVIm right after the Run Ex Command.

jakub-stastny commented 3 years ago

@terrychou thanks! It did help, although curiously enough I had to go the other way: first Open app, then Run Ex Command (which gets executed after these 10 seconds).

Just wondering, is there any plan for supporting the aforementioned URL schemes in the future?

Thanks for iVim!

terrychou commented 3 years ago

@jakub-stastny glad to know it helps.

As to the URL schemes support, I would prefer to implementing functionalities in Shortcuts unless it has to be done in the URL schemes way. If you have any suggestions, just let me know. :)

jakub-stastny commented 3 years ago

@terrychou may I ask why the preference for Shortcuts?

The way I see it, URL schemes are the most independent thing, it's the easiest one for integration (easy to integrate into Shortcuts as well as into Scriptable or Pythonista).

For instance in my workflow, I only ever use Shortcuts when there's something Scriptable cannot do (certain features of notifications for instance).

[1] And still – as it is now (meaning what we discussed in the previous comments about using Open app and all) is a workaround, it's fine for now, but either way what many people I suspect would want is a synchronous action for opening a desired file – and URL schemes sound natural fit for it in my opinion.

I do think having Shortcut actions is a good thing and the Shortcut actions that are already there make perfect sense, but I do not believe that they substitute the need of having URL schemes.

Anyway that's just my personal opinion. Would love to know your thoughts.

terrychou commented 3 years ago

@jakub-stastny I don't dislike URL schemes. Actually, my another app Locu is right based on it. The reason I choose Shortcuts over it is because there seems not so many users are really using it (according to my personal experience).

However, your points above are persuasive. I will consider about it when I have time. And it would be great if you have any specific suggestions and let me know.

sedm0784 commented 3 years ago

It'd be really nice if you could pass command line options (in particular -c or + options) via a URL scheme.

Failing that, I'd like to be able to run Vim and open an existing file in a given location, and perhaps also open a new file with contents passed in as a parameter.

jakub-stastny commented 3 years ago

@terrychou I see, that's interesting. I really do believe it'd be worthy feature, especially since there are things that Shortcuts simply cannot do (for instance opening an URL from a task manager, as I described above). Especially in iVim, which is an editor for programmers, I'd really assume many people would prefer Scriptable or Pythonista over Shortcuts, as it's just more natural for programmers to use. Don't get me wrong, I don't want to bash the Shortcuts integration, I think it's great it's there, but I personally do miss URLs schemes.

As for specific suggestions, it'd be great if it could open documents from various locations: not only "On my iPad", but preferably also iCloud Drive and others – Working Copy for instance, that'd be extremely helpful.

IMG_3199

To me personally, support for various locations would be on top of my wish list, although just supporting URLs within iVim's document directory would do as well.

Another half-fledged ideas:

These are just some ideas. From my perspective I'm more than happy with having the most basic solution that could be iterated upon down the road, no need for perfection from the get-go.

Thank you for considering it!

terrychou commented 3 years ago

I have just added the custom URL scheme support into iVim. If you have interest in trying or testing it before the formal release, just let me know.

sedm0784 commented 3 years ago

Yes, I'm definitely interested!

terrychou commented 3 years ago

Yes, I'm definitely interested!

Leave me an email address so I send you a TestFlight invitation.