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