On 2013-08-16 10:57, Gary Johnson wrote:
> On 2013-08-16, Javier Mediavilla Vegas wrote:
> > Hi all,
> > Is there any command or any method that allows to include a file
> > in the current file you are editing?
> > 
> > By including a file I don't mean to read it with :read and paste
> > it. I mean something like 
> >     \include{file}
> > 
> > The semantic that I am looking can be (merely an example):
> >     In normal mode, if some include is expanded, it deletes it
> >        contents and replaces the \include statement
> > 
> >     In insert mode, when the cursor is hover the line the include
> >        is written, vim reads the file, and copy its content to the
> >        line the statement was.
> > 
> > Basically, I would like to have a conceal behaviour for such an
> > order that loads a file as is in that moment so changes in the
> > file included are reflected in the file that includes it.
> 
> Do you mean something like this?
[snip]
> If not, it would help to know more about what you are trying to
> achieve.

I think the OP is asking for FoldOpen and FoldClose autocommands
(that would provide <foldstart> and <foldend> replacements to
specify the lines involved in the fold) in which one could do
something like (totally from the hip)

  :set fdm=marker
  :autocmd FoldOpen *.tex <foldstart>+1,<foldend>-1d_|<foldstart>r file.txt

This could be made more complex to pick the filename off the
fold-marker starting line, so you could have something like

  \include{file1.txt} {{{
  some recent(ish) content
  from file1.txt
  that would be replaced
  with fresh content
  from file1.txt
  every time this fold is opened.
  If the content of the include above
  was changed, then closing and
  reopening the fold would populate
  the content from the new file-name
  }}}

Unfortunately, I don't believe Vim exposes events when folds are
opened/closed.

-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 [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to