To demonstrate splits, open a relatively long file into a buffer then execute C-W s, which creates a "horizontal split" dividing the current window into upper and lower sections.
Now, type i to enter insert mode then type a few characters. These edits appear simultaneously in both split windows, which indicates that both windows provide views to the same buffer content.
Next, return to normal mode by hitting Esc, then hit G to move the cursor to the bottom of the buffer. Although each window shows the same document, but each can view (and edit) a different part of the document at the same time.
Finally, execute the C-W v command to "vertically split" the current window into two side-by-side windows, providing a third view to the current buffer.
Changing split window content
The previous examples created split windows that provide a second view on the current buffer content. While this can be helpful in some situations, split windows are not limited to a single buffer. In fact, split windows support all of the commands reviewed in the buffers chapter, which allow one to control which buffer is viewed in each split window.
Opening splits with content
Vim also allows one to open a file into a buffer, then display it in either a horizontal or vertical split. These are performed using the :split and :vsplit command-line commands:
:split path/to/file
:vsplit path/to/file
Note that if the paths are omitted these commands show the current buffer in the new splits, which is the same functionality of the C-W s and C-W v commands used earlier in this chapter.