On 20/10/09 06:51, winterTTr wrote:
>
> when we use ":e filename" , vim always create a new buffer and load the file.
> But the :r filename" just read the content to the current buffer , without
> associating the file information to the current buffer .
>
> Now , I use the bufnr('foo' , 1 ) to create a buffer , and then , i want to
> load
> a file ( like "D:\1.txt") to this buffer as while as associate the
> file information
> with this buffer , which seems that i use with one command ":e D:\1.txt".
>
> Can there be a way to do what i want ?
>
> PS:
> simply speaking , I would like to open ( not just read ) a file on
> the current buffer ,
> without creating a new buffer .
IIUC, it is not possible to change the name of a buffer. One buffer
means one file (which may have no disk existence).
The ":saveas" command will create a new buffer with the new name and the
old data; the old buffer (if not a [NoName] buffer) will keep its buffer
number and become the alternate buffer.
So after using ":saveas", you may, if the old buffer was "named", use either
:bdel #
to make it "unlisted" (but in this case it still exists and ":ls!" will
show it), or
:bwipe #
to make Vim "forget" everything about it (but the buffer number will not
be reused for anything in the present Vim session).
Best regards,
Tony.
--
In Tulsa, Oklahoma, it is against the law to open a soda bottle without
the supervision of a licensed engineer.
--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---