Thursday, July 12, 2012

Re: Cleaning up the buffer list

On Thu, Jul 12, 2012 at 06:34:32AM EDT, geoffrey.wood@thomsonreuters.com wrote:

[..]

> I have "set hidden" in my vimrc so I end up with a lot of
> buffers in the list.

Good to know I'm not alone.. :-)

Mind you, some might argue that you're not really supposed to use the
:ls command at all.. so basically you don't get to see it.. You just do
a ':b part_of_filename<TAB>' and Vim elegantly completes.. and display
a list of matches. So maybe it's a non-issue.

> From time to time I use the first example given here to
> delete all hidden buffers. Not sure if that's quite what
> you want?
>
> http://stackoverflow.com/questions/8450919/how-can-i-delete-all-hidden-buffers

Thanks, very useful.. An actually if you page down a bit, someone came
up with something quite similar to my effort..

> You can also use :bd to unload the buffer and delete it from
> the list once you've finished with it, to avoid leaving it
> in the buffer list. Possibly a dangerous habit to acquire
> though.

Very good point.. A lot of 'problems' are better addressed by adjusting
one's work habit than scripting contortions.. I had also thought about
this as an option.. e.g. a short user-defined command such as possibly
':QQ' that would quit and unload the buffer in one fell swoop..

I'm not sure I understand what 'danger' you are referring to, though..
If the target buffer is modified, Vim will complain (unless you do
a :bd!).. otherwise the only risk is that you'd have to reload the
buffer (:e file).

Thanks,

CJ

--
ALL YOUR BASE ARE BELONG TO US!

--
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

No comments:

Post a Comment