Loading ...
Sorry, an error occurred while loading the content.

Re: Close all buffers, stay open

Expand Messages
  • Tim Johnson
    ... 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
    Message 1 of 4 , Feb 27, 2010
    • 0 Attachment
      * sc <toothpik@...> [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@...
      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
    • Tim Johnson
      ... ... And the conclusion is: Works like a charm! thanks again -- Tim tim@johnsons-web.com http://www.akwebsoft.com -- You received this message from
      Message 2 of 4 , Feb 28, 2010
      • 0 Attachment
        * Tim Johnson <tim@...> [100227 19:04]:
        > * sc <toothpik@...> [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.
        <...>
        > > one thing i like to [easily] do is close all but the current
        > > buffer -- to this end i have
        And the conclusion is: Works like a charm!
        thanks again
        --
        Tim
        tim@...
        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
      Your message has been successfully submitted and would be delivered to recipients shortly.