Step 2 of 8

Commands for opening new windows

Commands for opening new windows

There are several ways to open a new window in Helix. Most of the time it involves splitting the current window in two — either horizontally (two windows stacked on top of each other) or vertically (two windows side by side). This is why you’ll often hear windows called “splits”.

The simplest ways in are the split commands: :hsplit (horizontal) and :vsplit (vertical), or :hs and :vs for short. Both accept a filename, which tells Helix to:

  1. Load the given file into a new buffer.
  2. Split the current window in two.
  3. Open the buffer in the new window, and move your cursor there.

A horizontal split opens below the current window and a vertical split opens to its right — and the new window is always the one you land in.

Alongside the editor’s exercise.txt there are three other files: a.txt, b.txt, and c.txt. Work through the checklist to open each one in a split of its own.

  1. Open a.txt in a horizontal split The new window will open underneath, with a.txt loaded inside — type :hsplit a.txt and press Enter.
  2. Open b.txt in a vertical split This one opens side by side — type :vsplit b.txt and press Enter.
  3. Open c.txt in one more split Type :hsplit c.txt and press Enter — four windows on one screen!
Open a.txt in a horizontal split The new window will open underneath, with a.txt loaded inside — type :hsplit a.txt and press Enter.

Next: Open b.txt in a vertical split

Loading editor…