terrychou / iVim

A vim port to iOS.
596 stars 35 forks source link

Anomalies with :iexdir #243

Closed EricEWeir closed 1 year ago

EricEWeir commented 2 years ago

Let me start off by saying I’m completely open to the possibility that what I’m going to describe reflects my poor understanding and use of :iexdir.

I have a link to a directory in iCloud Drive created with :iexdir -o name -d description. The directory contains three subdirectories. One of the subdirectories is a new one created for use by a new plugin, wiki.vim. Wiki.vim requires me to put the path to its directory in my .vimrc. The path—as I understand it—is ~/library/mobile documents/com~apple~CloudDocs/vimfiles/wiki/.

With this path in the .vimrc files created with the plugin should be saved in this directory. Instead, when I created my first file an entirely new directory, ~/0, was created and the file was saved in it.

I decided to see what would happen with another plugin, notes-vim. The path to its external directory is ~/library/mobile documents/com~apple~CloudDocs/vimfiles/mydocs/.

Again, files created with this plugin should be saved in that directory. Instead a new internal directory with subdirectories—/library/mobile documents/com~apple~CloudDocs/vimfiles/mydocs—was created the iVim documents folder and the file was saved there.

I’m betting I don’t understand the :iexdir very well. As I’m using it it’s not very helpful. Help would be appreciated.

Thanks.

EricEWeir commented 2 years ago

Not helpful primarily because files are not being saved in the target folders in the cloud. And thus are not available on other devices.

EricEWeir commented 2 years ago

I tested the path to files in the cloud with wiki.vim and notes-vim with MacVim on my MacBook. In both cases files were saved to the directories specified by the path in the .vimrc.

I believe I've followed the directions for creating a link to external directories for iVim. :iexdir add -o name -d description. But when the path to directories linked with the :iexdir command is provided for these plugins files are saved in new internal directories in weird locations.

I suspect the path to the external directory for iOS/iPadOS devices is different from that for macOS devices? If so, how do I determine what it is.

Help appreciated.

EricEWeir commented 2 years ago

Finally, a solution to this problem.

On a whim, negotiating into the very topmost folders of iVim in netrw I found some folders I wondered about. Particularly ~/library/ivim In it see /externaldirs, /externalitems, and /externalsymlinks.

Poking around for a while I found this: ~/library/externaldirs/bookmarks/767B00F4-A6D5-4B01-A62F-F217523BD92B/origin.

In it was this: ~/private/var/mobile/library/mobile documents/com~apple~clouddocs/vimfiles. I put it in my .vimrc as the root for wiki.vim.

It worked! Now I can create, open, and save files in iCloud Drive. Now I can sync directories between my devices.

I asked for help with this quite a while ago, here and elsewhere. I’m guessing there are many who could have pointed me to this. I hope I’m mistaken.