On Feb 7, 2:03 pm, Bram Moolenaar <[email protected]> wrote: ...[snip]...
> > (99% of unnamed and empty buffers will not have any of them) > > > Perhaps my case is unusual, but the :enew was used to create a scratch > > buffer in the middle of a plugin load sequence, after a bunch of > > buf-local variables had been created in the original buffer. I really > > needed to go back to the original buffer (after testing something in the > > scratch buffer), even if the original buffer happened to be an empty [No > > Name] buffer. > > > > This is only what I checked, not a complete list. > > > > I think Vim just tries to be smart and not waste buffer numbers ... > > > which isusually ok for me. > > > Perhaps so. If that's the case, though, why doesn't it reclaim one of > > the empty [No Name] buffers in case 1 above? It seems inconsistent. > > I don't know where it's documented, but when you do ":e file" while > editing an empty, unnamed buffer it re-uses that buffer. > > This was done to avoid empty, unnamed buffers to appear quite often, > especially with the sequence ":new" ":e file". Understood. > > An easy way to avoid the buffer being re-used is adding an empty line to > it (and setting 'nomodified'). You could give it a name, but you have > to make sure the name is unique. Thanks. I had been planning to assign a unique, dummy buffer name to the empty, unnamed buffer before executing :enew. But the approach you suggest is simpler. (With my approach, I would have had to create a function to generate a unique buffer name, and later :bwipe the unlisted buffer created by the :file command used to set the name of the original buffer back to [No Name].) Thanks, Brett Stahlman > > -- > hundred-and-one symptoms of being an internet addict: > 201. When somebody asks you where you are, you tell them in which chat room. > > /// Bram Moolenaar -- [email protected] --http://www.Moolenaar.net \\\ > /// sponsor Vim, vote for features --http://www.Vim.org/sponsor/\\\ > \\\ download, build and distribute --http://www.A-A-P.org /// > \\\ help me help AIDS victims --http://ICCF-Holland.org ///- > Hide quoted text - > > - Show quoted text - -- You received this message from the "vim_use" maillist. For more information, visit http://www.vim.org/maillist.php
