Skip to content

feat(nixvim): follow LazyGit worktree switches - #134

Merged
dc-tec merged 1 commit into
mainfrom
agent/lazygit-worktree-switching
Aug 4, 2026
Merged

feat(nixvim): follow LazyGit worktree switches#134
dc-tec merged 1 commit into
mainfrom
agent/lazygit-worktree-switching

Conversation

@dc-tec

@dc-tec dc-tec commented Aug 4, 2026

Copy link
Copy Markdown
Owner

Summary

  • enable LazyGit through Nixvim's native plugin module
  • use LazyGit's directory handoff to detect repository and worktree switches
  • open a switched worktree in a new tab rooted at that checkout, with the project dashboard
  • preserve existing callbacks and clean up the handoff on failed terminal exits and editor shutdown

Root cause

LazyGit runs as a child process of Neovim. Switching worktrees changes the child's working directory, but a child process cannot change Neovim's working directory, so the editor remained rooted in the original checkout.

User impact

Selecting another worktree in LazyGit and exiting with q now opens that checkout in a new editor tab while preserving the original tab. Exiting with Q keeps the original worktree.

Validation

  • nix flake check path:. --print-build-logs
  • generated Nixvim package build
  • headless runtime simulations for changed, unchanged, and failed LazyGit exits
  • environment restoration and Snacks dashboard assertions
  • manual nix run path:. -- --cmd 'cd <worktree>' verification
  • git diff --check

Signed-off-by: Roel de Cort <roel@decort.tech>
@dc-tec dc-tec self-assigned this Aug 4, 2026
@dc-tec
dc-tec marked this pull request as ready for review August 4, 2026 12:38
@dc-tec
dc-tec merged commit 9b4d052 into main Aug 4, 2026
2 checks passed
@dc-tec
dc-tec deleted the agent/lazygit-worktree-switching branch August 4, 2026 12:46
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.

1 participant