Vim 关闭窗口而不关闭缓冲区

2024-05-04

如何在不删除缓冲区的情况下关闭窗口或取消分割?


A window is a viewport on a buffer. In vim to manage windows it is CTRL+w the leading command, that you can follow with several options (in bold those that answer to your question):

CTRL+w, v: Opens a new vertical split

CTRL+w, s: Opens a new horizontal split

CTRL+w, c: Closes a window but keeps the buffer

CTRL+w, o: Closes other windows, keeps the active window only

CTRL+w, right arrow: Moves the cursor to the window on the right

CTRL+w, r: Moves the current window to the right

CTRL+w, =: Makes all splits equal size

然后,您需要切换窗口中的缓冲区:

:ls列出所有打开的缓冲区

:b5切换到第五个缓冲区

最后,要以垂直分割方式打开所有缓冲区,请使用::vertical sball。 当您在 grep 之后打开多个文件作为缓冲区时非常有用:

grep -rno --exclude-dir={dir1,dir2,dir3} "searchterm" *
vim $(!! -l)

有关更多信息,请参阅文档:vimdoc.sourceforge.net http://vimdoc.sourceforge.net/htmldoc/windows.html

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

Vim 关闭窗口而不关闭缓冲区 的相关文章

随机推荐