Thursday, August 1, 2019

Re: file subset of file updated

On 31.07.19 12:15, Bee wrote:
> Does vim have the ability to reference a file made of files?
>
> file A is a subset of file B
> file A = text
> file B = file A plus more text

In my experience, Vim edits multiple files, one at the time, and you can
switch between them. Where you have created separate files, there you
have separate files.

You could, though, make a simple text file listing the filenames of
those fragments, one per line, open it, put the cursor on a desired section,
and type gf - bingo!, you're in a document fragment.

> When file A is updated opening file B shows the changes

Is there a strong reason why the separate text sections required to
behave as a single document must be separate files? Vim has folding,
which allows me to maintain a document, today 28,794 lines long,
presenting it initially as one page of section headings. Scrolling the
cursor down to any particular heading and hitting <right arrow>¹ unfolds
that section.

That keeps currently uninteresting sections out of my hair, yet
associates all the parts of the document, without the need for another
file to list the parts of a fragmented document, in bits, here and
there.

It is, admittedly, not quite so convenient for making up several
documents from different selections of common fragments. However, when
folded, a section can be cut as a single line, and similarly pasted in a
new position in the document. That provides all the reordering power of
a fragmented document, without the hassle of inventing sticky tape to
put them together.

And the most powerful foldmethod requires the addition of delimiters.
But if the less intrusive methods did not suffice, then the delimiters
can be removed with a line of awk or sed, without effort. That is, after
all, the spirit of *nix: Each tool does one thing well, and the OS is
the glue which makes them into your custom machine.

¹ Emacs might have such a fragment linking mechanism, as it's a capable
OS - it just needs a good editor, as has been noted by others.

Erik

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/20190801094724.GA4740%40ratatosk.

No comments:

Post a Comment