Vim 中的 window 和 tab 非常具有迷惑性,跟我們平時所說的 “窗口” 和 “標籤頁” ,是完全不同的兩個概念,請看 vimdoc 給出的定義:
1:A buffer is the in-memory text of a file.
2:A window is a viewport on a buffer.
3:A tab page is a collection of windows.
簡單來說就是:
•buffer 可以看做是內存中的文本文件,在沒寫到磁盤上時,所有的修改都發生在內存中;
•window 用來顯示 buffer,同一個 buffer 可以被多個 window 顯示(一個 window 只能顯示一個 buffer);
•tab page 包含了一系列的 window,其實叫 layout 更合適
來看 Vim 官網上的一幅圖: