Last Updated: February 25, 2016
·
4.392K
· caioariede

Vim: Close a buffer without losing split/window

So you set up 3 split windows and now do you want to close one of them without losing the positioning. The problem is that :bw actually deletes the windows related to the buffer, as doc says: "Any windows for this buffer are closed"

Solution:

:ene | bw #

Or put the line below in your .vimrc:

nmap <leader>c :ene<CR>:bw #<CR>

And type \c

2 Responses
Add your response

What about :hide ?

[ You can use ":hide" to close a window without unloading the
buffer. ]

over 1 year ago ·

It's the reverse case. Keep the window but close the buffer.

over 1 year ago ·