Closing windows
When you’re done with a window, close it with :q or :close.
:q is the same command you use to quit Vim — but when more than one window is open, it only quits the current window. Vim itself exits only when the last remaining window gets a :q.
:close does almost the same thing — the only real difference is that it won’t try to quit Vim when it’s the last window.
There are three files alongside the editor’s exercise.txt: foo.txt, bar.txt, and baz.txt. Work through the checklist: open them in splits, then practice closing windows both ways.
1 2 3 4 5
Open foo.txt in a split Type :split foo.txt and hit Enter.
Open bar.txt in a vertical split Type :vsplit bar.txt and hit Enter.
Open baz.txt in one more split Four windows after this one — time to start closing them! Type :split baz.txt and hit Enter.
Close the current window with :close The window will disappear, but Vim keeps running — type :close and hit Enter.
Close another one with :q With windows still open, :q only quits the current one — type :q and hit Enter.
Next: Open bar.txt in a vertical split
Next: Open baz.txt in one more split
Next: Close the current window with :close
Next: Close another one with :q
Last one — goal check runs when it's done
Nice work!
Up next: The most important thing to remember.