Saturday, February 27, 2010

Re: Close all buffers, stay open

* sc <toothpik@swbell.net> [100227 17:03]:
> On Saturday 27 February 2010 07:11:05 pm Tim Johnson wrote:
>
> > For my purposes, it would be great if I could close all
> > buffers, but keep vim open.
> >
> > I note ':on', but that just closes all windows, buffers
> > remain.
> >
> > The end game is:
> > Close all buffers, load a different session.
> >
>
> one thing i like to [easily] do is close all but the current
> buffer -- to this end i have
>
> nnoremap <Leader>dd :call ClearBuffers()<CR>
>
> function! ClearBuffers()
> let i = 1
> let dc = 0
> while i <= bufnr("$")
> if buflisted(i) && i != bufnr("")
> exe "bdelete" i
> let dc += 1
> endif
> let i += 1
> endwhile
> echo 'buffers deleted:' dc
> endfunction
>
> in my .vimrc -- you could easily modify it (by removing the
>
> "&& i != bufnr("")"
>
> ) to delete even the current buffer
>
> hth,

I bet this *will* help.
I will implement this and let you know if I have any questions.
Thank you very much.
--
Tim
tim@johnsons-web.com
http://www.akwebsoft.com

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