Skip to content

fix: close side buffers when splitting current buffer - #28

Merged
sand4rt merged 1 commit into
sand4rt:mainfrom
pradyuman:pmn/fix-vsplit
Sep 12, 2026
Merged

sand4rt merged 1 commit into
sand4rt:mainfrom
pradyuman:pmn/fix-vsplit

Conversation

@pradyuman

Copy link
Copy Markdown
Contributor

Hi! I ran into an issue where running plain :vsplit wasn't hiding Zen's side buffers. This PR fixes that by handling WinNew through the same split logic as the existing BufWinEnter path (alongside a regression test).

zen.nvim has been great otherwise -- thanks for building it!

Copilot AI lite review requested due to automatic review settings September 8, 2026 04:06

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The change is small, consistent with existing autocmd logic, and includes a focused regression test for the reported scenario.

Pull request overview

This PR fixes a Zen side-buffer visibility bug when users split the current buffer via plain :vsplit, by ensuring the same “multiple vsplits” closure logic runs on WinNew (not just BufWinEnter). It also adds a regression test to cover the previously failing scenario.

Changes:

  • Extend the existing autocmd logic to also handle WinNew, ensuring side buffers close when splitting the current buffer.
  • Add a regression test for :vsplit with no target file (splitting the current buffer).
File summaries
File Description
lua/zen/init.lua Adds WinNew handling to trigger the existing split-detection/side-buffer close logic for current-buffer splits.
tests/test_splits.lua Adds a regression test verifying :vsplit (without a file arg) closes Zen side buffers.
Review details
  • Files reviewed: 2/2 changed files
  • Comments generated: 0
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@sand4rt

sand4rt commented Sep 12, 2026

Copy link
Copy Markdown
Owner

Thanks!

@sand4rt
sand4rt merged commit 5fd4b1c into sand4rt:main Sep 12, 2026
1 check passed
@pradyuman
pradyuman deleted the pmn/fix-vsplit branch September 12, 2026 17:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants