Closing a buffer
If you like to keep your buffer list tidy, you can use the :buffer-close command — or its short alias :bc — to remove a buffer from the list. :buffer-close by itself closes the current buffer and drops you into the one you were in last, but you can also give it a path — the one the statusline shows, like /work/b.txt — to close a buffer without switching to it first.
And don’t worry — if you try to close a buffer that has unsaved changes, Helix will stop you from proceeding.
Work through the checklist below. Open a.txt and close it again from inside the buffer, then open b.txt and bar.txt. Close b.txt by name and prove it worked with gp — the walk now skips straight over where b.txt used to sit. Finally, hop back to bar.txt and close it from the inside.
1 2 3 4 5 6 7
Open a.txt Type :e a.txt and press Enter.
Close the buffer you're in Helix drops you back in exercise.txt — type :buffer-close (or its short alias :bc) and press Enter.
Open b.txt Type :e b.txt and press Enter.
Open bar.txt Type :e bar.txt and press Enter.
Close b.txt without switching to it, then check with gp Type :buffer-close /work/b.txt (the path as the statusline shows it) and press Enter, then press gp — with b.txt gone, it takes you straight back to exercise.txt.
Hop back to bar.txt with gn It's the only other buffer left — type gn.
Close bar.txt too Only exercise.txt is left to land in — type :buffer-close and press Enter.
Next: Close the buffer you're in
Next: Open b.txt
Next: Open bar.txt
Next: Close b.txt without switching to it, then check with gp
Next: Hop back to bar.txt with gn
Next: Close bar.txt too
Last one — goal check runs when it's done
Nice work!
That was the last lesson — you've finished the course.