feat: visible_only mode, toggle command, neo-tree reveal improvements#18
feat: visible_only mode, toggle command, neo-tree reveal improvements#18kam-hak wants to merge 1 commit intoCannon07:mainfrom
Conversation
- Add diff.visible_only config (default false) — only show diff for
files open in a visible nvim window; auto-approve others
- Add :ClaudePreviewToggleVisibleOnly command for session toggle
- Add neo_tree.reveal config (default true) — disable to skip reveal
- Add neo_tree.reveal_root config ("cwd"|"git") — pass dir param to
neo-tree reveal instead of changing nvim's cwd
- Batch all config + visibility queries into single M.hook_context() RPC
- Use vim.uv.fs_realpath() for canonical path resolution
- Guard close-diff hook: only clean up when a diff is actually open
- Remove post-close reveal to avoid stale CWD prompts
|
Thanks for the PR! The config design is well thought out — safe defaults that preserve existing behavior with opt-in flags. A few things to address before merging:
Looking forward to the updated PRs! |
|
Great. Thanks for the review, and for this addon. Its exactly what I was looking for. Split into separate PRs per your feedback:
Also fixed the |
Problem
No control over which files diffs were viewed in. Often, I have a 'focus' set of files (with diffs I want to review in context), alongside non-logic changes (e.g. updating vars to pass context). Every file edit opens a diff tab — even files you've never opened. A 10-file refactor means 10 diff panes. Additionally, neo-tree's
reveal()triggers interactive "File not in cwd?" prompts when editing files outside nvim's working directory.Changes
diff.visible_only(false) — only show diff preview for files open in a visible nvim window; auto-approve others silently:ClaudePreviewToggleVisibleOnly— session toggle forvisible_onlyneo_tree.reveal(true) — set tofalseto disable neo-tree file revealneo_tree.reveal_root("cwd") — set to"git"to pass the git root (or file's parent dir as fallback) as neo-tree'sdirparam, preventing CWD promptsM.hook_context()call instead of 4 separate--remote-exprspawnsvim.uv.fs_realpath()for canonical path resolution; case-insensitive only on macOSAll defaults match existing upstream behavior — fully backwards compatible.
Example config
Test plan
visible_only: true— edit a file open in nvim → diff shown, approve prompt; edit a file not open → auto-approved, no diff:ClaudePreviewToggleVisibleOnly— flips visible_only for the session, notifiesneo_tree.reveal: false— no neo-tree reveal calls, no CWD promptsneo_tree.reveal_root: "git"— reveal works for files outside nvim's cwd; files outside any git repo fall back to parent dir:lower()