orgmode
                                
                                 orgmode copied to clipboard
                                
                                    orgmode copied to clipboard
                            
                            
                            
                        Add org-attach feature
Hi, apologies for dropping such a large PR in your lap!
I've been working on-and-off on attachments and it's in a state now where I believe it works as intended and very similarly to the Emacs version. :slightly_smiling_face:
The feature seemed simple., but ended up ballooning because:
- the Emacs version uses a lot of Emacs machinery that nvim doesn't have (recursive copying, downloads);
- I ended up having to modify several utils functions (like orgmode.utils.fs.substitute_path) for my use case.
I've split commits up as much as I could to make accepting/rejecting each individual change easier. I've also split the implementation of org-attach into 6-7 commits to make it easier to review them.
To be clear, I don't expect all changes to go into the main repository. Let me know if there are any design decisions that you'd rather not commit to maintaining. :wink:
Some of my more dubitable choices:
- I wrapped a lot of vim.uv.fs_*functions in a moduleorgmode.attach.fs. I simply couldn't figure out how to write an async recursive copy any other way.
- I wrote a few new dialogs in orgmode.attach.ui. Some look weird because they replicate Emacs dialogs (yes_or_no_or_cancel_slow()is the equivalent of yes-or-no-p) and might not necessarily make sense in nvim.
- The Emacs version wildly interleaves logic and user interaction. Elisp has a lot of macros that make this work, unlike Lua. To keep the code clear, I've put the actual logic into orgmode.attach.coreand wrapped it inorgmode.attach. This separation required passing around a few callbacks and effectively writing every function twice. It may be more work than it's worth.
Thanks again for keeping this project going, it's been helping me a lot!