Step 3 of 8

Two windows, one buffer

Two windows, one buffer

I mentioned that :hsplit and :vsplit accept a filename — but the filename is actually optional! Run them bare and you’ll split the current window in two, leaving the new window peering into the same buffer.

Interesting! Multiple windows can be “looking at” the same buffer. This is really useful in a large file: you can keep two far-away sections visible on screen at the same time. And since it’s all one buffer, an edit made in any window shows up in all of them.

Work through the checklist: split the window, then make an edit and watch it appear in both windows at once. Remember that Helix selects before it acts: x selects the whole line, and d deletes the selection.

  1. Split the window with a bare :vsplit No filename this time — two windows will peer into the same buffer. Type :vsplit and press Enter.
  2. Delete the top line and watch both windows change Press gg to jump to the first line, x to select it, then d to delete it — the edit appears in _both_ windows at once.
Split the window with a bare :vsplit No filename this time — two windows will peer into the same buffer. Type :vsplit and press Enter.

Next: Delete the top line and watch both windows change

Loading editor…