I know that :qa
closes all the buffers and windows and exits vim. It's also clear that I could use :q
to quit a single window/split in a given tab. But consider the case where I have three windows in the current tab and a bunch of adjacent open tabs as well. I want to close the three windows in the current tab but not quit vim or the other adjacent tabs.
How do I do it? I went through the vim help file, but there doesn't seem to a direct option. I imagine it's possible to get such functionality using vimscript, but I want to be sure before drawing the conclusion that it's the only option.
If vim doesn't support it directly and someone has been awesome enough to write a plugin for it, I would love to know about it.
You can type Ctrl-W c to close the current window. If that window is the last window visible in a tab, the tab is also closed (if another tab page is currently open).
Other ways to exit Vim Esc + :x + Enter (Save and exit) Esc + :qa + Enter (Quit all open files) Esc + Shift ZZ (Save and exit) Esc + Shift ZQ (Exit without saving)
:wa - save all tabs / unsaved buffers. :xa / :wqa - save all tabs / unsaved buffers and exit Vim.
Do you mean you want to close the current tab page? Then there's the :tabclose
command for that.
I also found out this command works. The help page at help tabpage
was quite useful.
:tabc
Like @glts pointed out in a comment, I needed to get my vim terminology in order before I could find an answer.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With