May 17, 2026

Split Windows

If you have the book, "Practical Vim" go to page 92 and read all about them. The following is an executive summary of the things I use.

Suppose I am in the midst of editing file A and find some reason to want to access file B. I type:

:sp B
This brings in file B, splitting my window into a top half and bottom half. It places B in the top half, and squeezes A into the bottom half. It starts with B (in the top half) active.

To switch from B to A (and back again) type Ctrl-W Ctrl-W. Just hold down the Control key and type "w" twice. There are a bunch more tricks, but you can get things done with just this and we are keeping things simple.

Just for the record, you can type just ":sp" and get file A in both the top and the bottom. This can be useful when you want to look at two parts of the same file "side by side" (so to speak).

You can yank in one file, then put into the other (the most common reason I dive into this split window business). When you get tired of being split just use :q in the window you want to get rid of (or use ZZ if appropriate).

Vim terminal

This is a special sort of a split window. Type ":term" and you get a split with a terminal (yes, a working terminal) in the top split.

The trick is to type Ctrl-\ Ctrl-n to switch from being a terminal to being Vim and editing what is displayed.

Then use "i" to get back to being a terminal.

Use ":h terminal" to view the online help -- there is much more.

Make it pretty

It takes a sharp eye to see where one window stops and the other starts. Almost the first day I began using this feature, I was itching to make one window stand out from the other. Sadly there is nothing quck and easy, so just train your eye. The methods described in the above involve several plugins and more fiddling than I want to do, at least right now.

Vim uses the status line to separate the horizontal splits that I am using, so if you want to emphasize the separation, you have to fool with the status line. This is not a bad idea, but is a topic of its own.

For vertical splits (which I currently avoid), you monkey with the "fillchars" variable. Note in the following that several spaces follow the backslash:

:set fillchars+=vert:\


Have any comments? Questions? Drop me a line!

Tom's vim pages / tom@mmto.org