Skip to content

feat: visible_only mode to limit diffs to open buffers#22

Closed
kam-hak wants to merge 1 commit intoCannon07:mainfrom
kam-hak:feat/visible-only
Closed

feat: visible_only mode to limit diffs to open buffers#22
kam-hak wants to merge 1 commit intoCannon07:mainfrom
kam-hak:feat/visible-only

Conversation

@kam-hak
Copy link
Copy Markdown
Contributor

@kam-hak kam-hak commented Apr 4, 2026

Problem

When Claude edits many files in a session, every edit opens a diff preview and waits for approval — even for files the user isn't looking at. This slows down bulk operations where only a few files need careful review.

Changes

  • Add diff.visible_only config (default false, no behavior change)
  • When enabled, only files open in a visible nvim window get diff previews and permission prompts
  • Files not visible are auto-approved silently
  • Add :ClaudePreviewToggleVisibleOnly command for runtime toggling
  • Add hook_context() to batch config + file visibility check into one RPC call
  • Preserve "ask" fallback when Neovim is not running (no change to default safety behavior)

Test plan

  • Default config (visible_only = false) — all edits prompt as before
  • Enable visible_only = true — only open files show diffs
  • Toggle with :ClaudePreviewToggleVisibleOnly — takes effect on next edit
  • Kill nvim, run an edit — CLI still prompts (not auto-approved)

When diff.visible_only = true, only files already open in a visible
nvim window get a diff preview and permission prompt. Files not
visible are auto-approved so they don't interrupt flow.

- Add diff.visible_only config (default false, no behavior change)
- Add :ClaudePreviewToggleVisibleOnly for runtime toggling
- Add hook_context() to batch config + visibility into one RPC call
- Preserve "ask" fallback when Neovim is not running
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