file subset of file updated

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

file subset of file updated

Bee-16
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

When file A is updated opening file B shows the changes

--
--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/8411df1e-78ac-473f-9198-41a6ab76b802%40googlegroups.com.
Reply | Threaded
Open this post in threaded view
|

Re: file subset of file updated

Tim Chase
On 2019-07-31 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
>
> When file A is updated opening file B shows the changes

Not out of the box AFAIK.

It would help to know the type of inclusion:  are these C-style
#include files? or are they LaTeX with \input{filename} style
includes?  And what tooling are you using to generate the resulting
file you want to view?

My first inclination would be to lean on make(1) to generate the
output file based on the input files (updating based on their
changes), then create an autocmd (`:help autocmd` and `:h
BufWritePost`) that runs :make when you save and optionally loads the
results into a preview window.

-tim


--
--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/20190731142857.60bfe8c2%40bigbox.christie.dr.
Reply | Threaded
Open this post in threaded view
|

Re: file subset of file updated

Erik Christiansen
In reply to this post by Bee-16
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/20190801094724.GA4740%40ratatosk.