Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I close all windows only in the current tab of vim

Tags:

vim

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.

like image 892
gkb0986 Avatar asked Sep 28 '13 12:09

gkb0986


People also ask

How do I close a tab in Vim?

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).

How do I close all Vim files in Linux?

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)

How do we save and quit for all active tabs Vim?

:wa - save all tabs / unsaved buffers. :xa / :wqa - save all tabs / unsaved buffers and exit Vim.


2 Answers

Do you mean you want to close the current tab page? Then there's the :tabclose command for that.

like image 77
jamessan Avatar answered Sep 27 '22 18:09

jamessan


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.

like image 33
gkb0986 Avatar answered Sep 27 '22 18:09

gkb0986