On 08/09/09 07:23, Ben Fritz wrote: [...] > On Sep 6, 4:57 am, Bastiaan Wakkie<[email protected]> wrote: [...] >> If I open files with >> >> --remote-tab-silent >> >> They end up in a tab but also in a buffer. If I then close the tab I >> still have them in my buffer. Very confusing. > > Quite simple, really. > > * 1 file per buffer, and a file always has a buffer. Buffers is how > you would previously edit multiple files in full-screen fashion.
I'd stay a buffer is a memory area used by Vim to "remember" the current state and contents of an editfile. It is possible for a buffer to be 'hidden'; in that case it does not appear in any window of any tab page, but its contents are still in memory. > * A window is a view-port onto a single buffer. You can have any > number of view-ports to the same buffer, hence any number of windows > per file. > * A tab contains any number of windows. Each window in a tab page can > view any loaded buffer. Hence, any number of files per tab, and any > number of tabs per file (because the buffer viewports can be in any > tab). > > One potentially confusing behavior is that quitting a window with :q > or :close or even :tabclose does not delete the buffer being viewed. > This may be the source of some of your confusion. There are reasons > for this, one of which would be to allow the same file to be open in > multiple windows and/or tabs without a :close on one window causing > problems in others. > > If you know for certain that this is the only window/tab in which the > file's buffer is being viewed, you can use :bd instead of :q to close > it, and the buffer WILL be deleted. Actually, it will only become "unlisted". To completely erase all traces of whatever Vim associates with a buffer, there exists the ":bw[ipeout]" command, but don't use it unless you know what you're doing. Three commands belong in that family, actually: in increasing order of severity, :bun[load], :bd[elete], :bw[ipeout]. Assuming that the buffer can be |abandon|ed (q.v.), :bun will reclaim its memory but remember its marks, :bd does the same but makes it "unlisted" (in order to see that Vim knows about the buffer, you must then use an exclamation mark after ":ls", ":files" or ":buffers"), :bw forgets everything that Vim knew about the buffer, including its marks, one of which is its latest cursor position; the buffer's number is then made unused, and I don't think another buffer can reuse it in the same Vim session. Whether Vim hides, unloads, deletes or wipes a buffer when it is no longer displayed in a window depends on the settings of the 'hidden' and 'bufhidden' options, and on whether the ":hide" command (which can be either a standalone command or a prefix) was used to remove that buffer from view. Best regards, Tony. -- "How do you like the new America? We've cut the fat out of the government, and more recently the heart and brain (the backbone was gone some time ago). All we seem to have left now is muscle. We'll be lucky to escape with our skins!" --~--~---------~--~----~------------~-------~--~----~ You received this message from the "vim_use" maillist. For more information, visit http://www.vim.org/maillist.php -~----------~----~----~----~------~----~------~--~---
