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

55213RE: Quick: delete buffer & keep window

Expand Messages
  • John Orr
    Dec 1, 2004
    • 0 Attachment
      FYI - just added http://www.vim.org/scripts/script.php?script_id=1147 to do
      this task the way I think it should be done.

      John

      > -----Original Message-----
      > From: Keith Roberts [mailto:kroberts@...]
      > Sent: Friday, 29 October 2004 5:36 PM
      > To: overbored; vim@...
      > Subject: RE: Quick: delete buffer & keep window
      >
      >
      > >-----Original Message-----
      > >From: overbored [mailto:overbored@...]
      > >Sent: Friday, October 08, 2004 12:03 AM
      > >To: vim@...
      > >Subject: Quick: delete buffer & keep window
      > >
      > >Is it possible to delete a buffer (:bd) without closing the
      > >window (and instead do something like switch to another
      > >buffer)? Thanks in advance.
      >
      > Here's what I use:
      > " Delete buffer, move to Alternate (or next)
      > map <C-S-F4> :if bufnr('#') >
      > 0\|:b#\|:else\|:bn\|:endif\|:bw#<CR>
      > imap <C-S-F4> <ESC><C-S-F4>
      > " Unload buffer, move to Alternate (or next)
      > map <C-F4> :if bufnr('#') >
      > 0\|:b#\|:else\|:bn\|:endif\|:bunload #<CR>
      > imap <C-F4> <ESC><C-F4>
      >
      > ... and just for good measure ...
      >
      > " Delete buffer, move to Previous (does NOT remove window)
      > map <C-S-F7> :bp<CR>:bw #<CR>
      > imap <C-S-F7> <ESC><C-S-F7>
      > " Unload buffer, move to Previous
      > map <C-F7> :bp<CR>:bunload #<CR>
      > imap <C-F7> <ESC><C-F7>
      > " Unmapped
      > map <S-F7> :echo "Unmapped!"<CR>
      > imap <S-F7> <ESC>:echo "Unmapped!"<CR>l
      > " Move to Previous buffer
      > map <F7> :bp<CR>
      > imap <F7> <ESC><C-F7>
      >
      > " Delete buffer, move to Next (does NOT remove window)
      > map <C-S-F8> :bn<CR>:bw #<CR>
      > imap <C-S-F8> <ESC><C-S-F8>
      > " Unload buffer, move to Next
      > map <C-F8> :bn<CR>:bunload #<CR>
      > imap <C-F8> <ESC><C-F8>
      > " Unmapped
      > map <S-F8> :echo "Unmapped!"<CR>
      > imap <S-F8> <ESC>:echo "Unmapped!"<CR>l
      > " Move to Next buffer
      > map <F8> :bn<CR>
      > imap <F8> <ESC><C-F8>
      >
      > I uses the F7/F8 series to quickly traverse the buffer list in either
      > direction, but now that I use locate and lid so much I more often use
      > the F4 series.
      >
    • Show all 9 messages in this topic