How to close buffer without closing the window?

mike3996

I usually open a few windows and keep some buffers open. Since my MO in buffer exploring is to use quick shortcuts to :bn and :bp, I want to close unneeded buffers from distracting my buffer surfing.

But the pain is, issuing :bd and :bw results in closing the window as well, in case I have multiple ones open. How do I close (delete) a buffer and leave the windows intact?

Solution inspired by @peth's answer

:command! BW :bn|:bd#

It is simple. Doesn't work well with only one buffer open (I get different behaviour depending on the way I open the files) but it isn't a big issue. :)

peth

It can be a pain, this question is raised over and over on #vim (Freenode), too.

Some people recommend not deleting buffers and switching with :b partial<Tab> instead of :bn, which works, but isn't what you're asking.

The best way I know of to do that is to switch to another buffer and then :bd#, which you could map, of course.

See also Deleting a buffer without closing the window on the Vim wikia.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Vim close window without closing buffer

From Dev

How to close [No Name] buffer without closing vim?

From Dev

How to close tkinter window without a button and not closing Python completely?

From Dev

close sub-window without closing main window PyGTK in python

From Dev

How do you close 1 window of a gui that has 2 windows open without closing both?

From Dev

Python Tkinter - Close dialog without closing main window

From Dev

Is it possible to close the ssh session without closing byobu or the window?

From Dev

Close window confirmation on mdi parent without closing child

From Dev

How to do grid update without closing window

From Dev

Windows 10: How to hide window without closing?

From Dev

How to do grid update without closing window

From Dev

How to close serial port when closing window with pyqt5

From Dev

How to open a window without "close" button?

From Dev

How to open a window without "close" button?

From Dev

How to close tab without using window open

From Dev

How to close tkinter window without a button?

From Dev

How to close a scanner without closing the underlying System.in?

From Dev

How to close a called class using JFrame without closing the class that called it?

From Dev

how to close only one awt Frame without closing other?

From Dev

How can I close the MainForm, without closing the others?

From Dev

how to close only one awt Frame without closing other?

From Dev

emacs: How to display a buffer without switching window and without raising frames?

From Dev

emacs: How to display a buffer without switching window and without raising frames?

From Dev

How do I terminate a 'Ping' without closing the command terminal window?

From Dev

How do I terminate a 'Ping' without closing the command terminal window?

From Dev

MonoMac window closing without error

From Dev

Close the window when closing the last tab

From Dev

How to prevent tkinter window from closing when I close Windows command console

From Java

Close two windows without closing a third

Related Related

  1. 1

    Vim close window without closing buffer

  2. 2

    How to close [No Name] buffer without closing vim?

  3. 3

    How to close tkinter window without a button and not closing Python completely?

  4. 4

    close sub-window without closing main window PyGTK in python

  5. 5

    How do you close 1 window of a gui that has 2 windows open without closing both?

  6. 6

    Python Tkinter - Close dialog without closing main window

  7. 7

    Is it possible to close the ssh session without closing byobu or the window?

  8. 8

    Close window confirmation on mdi parent without closing child

  9. 9

    How to do grid update without closing window

  10. 10

    Windows 10: How to hide window without closing?

  11. 11

    How to do grid update without closing window

  12. 12

    How to close serial port when closing window with pyqt5

  13. 13

    How to open a window without "close" button?

  14. 14

    How to open a window without "close" button?

  15. 15

    How to close tab without using window open

  16. 16

    How to close tkinter window without a button?

  17. 17

    How to close a scanner without closing the underlying System.in?

  18. 18

    How to close a called class using JFrame without closing the class that called it?

  19. 19

    how to close only one awt Frame without closing other?

  20. 20

    How can I close the MainForm, without closing the others?

  21. 21

    how to close only one awt Frame without closing other?

  22. 22

    emacs: How to display a buffer without switching window and without raising frames?

  23. 23

    emacs: How to display a buffer without switching window and without raising frames?

  24. 24

    How do I terminate a 'Ping' without closing the command terminal window?

  25. 25

    How do I terminate a 'Ping' without closing the command terminal window?

  26. 26

    MonoMac window closing without error

  27. 27

    Close the window when closing the last tab

  28. 28

    How to prevent tkinter window from closing when I close Windows command console

  29. 29

    Close two windows without closing a third

HotTag

Archive