Skip to content

feat(explorer): Add auto_open_on_cursor and auto_open_debounce_ms options#400

Open
craftzdog wants to merge 1 commit into
esmuellert:mainfrom
craftzdog:auto_open_on_cursor
Open

feat(explorer): Add auto_open_on_cursor and auto_open_debounce_ms options#400
craftzdog wants to merge 1 commit into
esmuellert:mainfrom
craftzdog:auto_open_on_cursor

Conversation

@craftzdog
Copy link
Copy Markdown

Hi! I love this plugin for my agentic workflow. I wanted to add a feature that allows you to automatically open the diff for the file under the cursor so that I can review files more quickly.

Summary

Adds an opt-in mode that auto-opens the diff for the file under the cursor as you move through the explorer with j/k, so you can browse changes without pressing Enter on each file.

Changes

  • auto_open_on_cursor (default false) — when enabled, moving the cursor in the explorer opens the diff for the node beneath it.
  • auto_open_debounce_ms (default 80) — debounce window so fast j/k traversal doesn't spam diff loads.

The CursorMoved handler is debounced and skips group/directory nodes and the already-open file. Its timer is cleaned up on BufWipeout.

Config

explorer = {
  auto_open_on_cursor = false,  -- auto-open diff for file under cursor while moving
  auto_open_debounce_ms = 80,   -- debounce window (ms) for the above
}

Test plan

  • Unit tests in tests/ui/explorer/explorer_spec.lua cover the debounce behavior, node-type skipping, and duplicate-file guards.

… options

Auto-open diff for the node under cursor while moving (j/k) in the explorer.
Debounced so fast traversal doesn't spam diff loads; the duplicate-file guards
inside on_file_select handle the cases where the cursor lands back on the
already-open file (e.g. after navigate_next).
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