Thursday, July 12, 2012

Re: Cleaning up the buffer list

On Thursday, 12 July 2012 00:38:04 UTC+1, Chris Jones wrote:
> I usually have a single Vim instance that stays up for weeks if not
> months at a time, such that I eventually have a large number of buffers
> as listed by the ':ls/:buffers' command.. well over 100 at this point in
> time. Even though I usually take good care to exit files once I know
> I will no longer need them (via a ':q/:wq').

> [I wrote a function to] feed the output of the :ls command to a variable and
> filter out buffers that are either 'active' (displayed in a window) or
> 'modified'. All others get buffer-wiped. [The function
> has potential problems.]

> Has anyone looked into buffer list manipulation before and could advise
> on a different approach & suggest how I might be able to come up with
> something a bit less clunky..?

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

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

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.

regards,
Geoff

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