Step 4 of 8

Closing windows

Closing windows

When you’re done with a window, close it with Space-w q or :q.

:q is the same command you use to quit Helix — but when more than one window is open, it only closes the current window. Helix itself exits only when the last remaining window gets a :q.

Space-w q does almost the same thing from the keyboard: press the Space key, then w, then q. That’s the window menu, which the next step covers properly — for now, just know that q in the menu closes the window you’re in. (Space-w o is the opposite: it closes every window except the current one.)

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. Open foo.txt in a split Type :hsplit foo.txt and press Enter.
  2. Open bar.txt in a vertical split Type :vsplit bar.txt and press Enter.
  3. Open baz.txt in one more split Four windows after this one — time to start closing them! Type :hsplit baz.txt and press Enter.
  4. Close the current window with Space-w q The window will disappear, but Helix keeps running — press Space, then w, then q.
  5. Close another one with :q With windows still open, :q only quits the current one — type :q and press Enter.
Open foo.txt in a split Type :hsplit foo.txt and press Enter.

Next: Open bar.txt in a vertical split

Loading editor…