1

Is there any existing plugin or gist somewhere that would allow you to embed one text file inside another? Ideally it'd also allow editing the embedded file from the file in which it is embedded.

This functionality is demonstrated, more complexly, in the https://github.com/tbabej/taskwiki plugin that integrates vimwiki with taskwarrior. TaskWiki provides "viewports" which are automatically generated lists of task commands -- you can edit a task in taskwarrior and the edit will be automatically reflected in the taskwiki viewport, likewise changes made within the taskwiki viewport get written to the taskwarrior data.

TaskWiki let's you add a line to your wiki page like this: == Tasks | +retribe +PENDING == which will then create the "viewport" below that line.

So what I'm dreaming of is some kind of syntax like ++ arbitrary title | /path/to/embedded-file.txt ++ that would then create a similar sort of "viewport" of that file to also allow me to edit that file from right there inside the viewport.

In my case, I'm trying to bridge the gap between vimwiki/taskwiki and tasknote files which allow for keeping track of much more information about a task than taskwarrior itself is able to store.

TaskWiki has a bunch of code in the implementation of its "viewport" concept, and not being familiar with the architecture of vim plugins makes creates a huge hurdle for me to just look and see how TaskWiki did. I imagine simply embedding a text file would be far simpler than what TaskWiki is doing (since TaskWiki's viewports are dynamic querries of the taskwarrior data and have mappings to several different actions (as opposed to just one action of updating a simple text file)).

Does anything else like this already exist? If not... Can anyone suggest how to get started scripting a solution for this?

  • What's wrong with plain source another_file and pressing gf to switch to that file? – Matt Jul 3 at 6:27
  • 2
    Remember it's an text editor and as such a feature such as embedding one file into another is out of scope. – Christian Brabandt Jul 3 at 6:30
  • @Matt isn't :source anotherfile just used to execute commands written in that file? – alec Jul 3 at 13:00
  • It's not really about :source. If you have any filename in your editing buffer then pressing gf switches to editing that file. – Matt Jul 3 at 13:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.