Am 2015-04-01 11:30, schrieb [email protected]:
Hello!

I have some VimL where I write the current buffer to a temporary file like this:

    let tmp = tempname()
    execute 'keepalt silent write' tmp

I then use the temporary file in an external command invoked with
system().  Finally I delete the temporary file:

    call delete(tmp)

At no point do I load, or want to load, the temporary file into a vim buffer.

However every time my VimL executes, a new buffer number is taken
because the temporary file is allocated an unlisted buffer (visible
with :ls!).  How can I prevent Vim allocating buffers for my temporary
files?

For example:

1. Open some file in Vim.  This is loaded into buffer 1.
2. Execute my VimL ten times.
3. Open some other file.

Desired behaviour: "some other file" is loaded into buffer 2.
Actual behaviour: "some other file" is loaded into buffer 12.

I fail to understand, why this is a problem, but you should
be able to work around that using the writefile() function,
which seems to be better suited for such a case.

BTW: I think this is rather a topic for vim_use and not vim_dev.

Best,
Christian

--
--
You received this message from the "vim_dev" 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_dev" 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/d/optout.

Raspunde prin e-mail lui