我把窗户横着分开了。现在我如何回到正常模式,即没有分裂窗口,只有一个窗口,而不取消所有打开的窗口。我有5个,并不想“退出”,只是想从分裂的窗口出去。


当前回答

按Control+w,然后按q一次关闭每个窗口。

更新:也考虑eckes的答案,这可能对你更有用,包括:on(阅读下面),如果你不想一次只做一个窗口。

其他回答

命令:hide将隐藏当前聚焦的窗口。我认为这就是你想要的功能。

为了在窗口之间导航,键入Ctrl+w后跟一个导航键(h,j,k,l或方向键)

有关更多信息,请运行:help window和:help hide in vim。

按Control+w,然后按q一次关闭每个窗口。

更新:也考虑eckes的答案,这可能对你更有用,包括:on(阅读下面),如果你不想一次只做一个窗口。

提供窗口号以关闭特定窗口而不保留当前窗口:

:[N]close
:close[N]
:[N]quit
:quit[N]
Ctrl-W[N]c

窗口号可以通过以下设置显示在状态行中:

:set statusline+=%{tabpagewinnr(tabpagenr())}

要关闭所有分割,我通常将光标放在on-ly可见的窗口中,然后执行:,使当前窗口成为on-ly可见窗口。很好的助记方法。


Edit::help:on告诉我这些命令是相同的:

:在 :只有 CTRL-w CTRL-o 是的,CTRL-W o也有同样的效果(正如Nathan回答的那样)。

这四个选项都会关闭除活动窗口外的所有窗口。

help open -window(搜索" close a window" - / close a window)

:q[uit] close the current window and buffer. If it is the last window it will also exit vim :bd[elete] unload the current buffer and close the current window :qa[all] or :quita[ll] will close all buffers and windows and exit vim (:qa! to force without saving changes) :clo[se] close the current window but keep the buffer open. If there is only one window this command fails :hid[e] hide the buffer in the current window (Read more at :help hidden) :on[ly] close all other windows but leave all buffers open