A sidebar on Ctrl+B: drill's first plugin, clickable to the last gesture
Stacked on #17 (feat/macos-cmd) — merge that first; this PR retargets main cleanly after.
What this is
An optional file-explorer sidebar on Ctrl+B / Cmd+B — drill's first and only plugin-powered feature, built to stay an exception:
- nvim-tree draws the tree, nvzone/volt + nvzone/menu draw the right-click menu — three checkouts pinned to exact SHAs by the new
vendor.sh(a pin table and a loop, not a plugin manager). - Nothing loads at startup. The checkouts aren't on the runtime path until the first toggle; never press Ctrl+B and you run the config drill always had.
- The same branch seals the packpath leak: user plugins in
~/.local/share/nvim/site/pack/*/startloaded inside drill despite the "no plugins" promise (measured). Both site dirs now come offruntimepathandpackpath, with a suite assert.
The gestures (all mouse, all pty-tested)
- One click opens a file (never into the REPL — window_picker excludes terminals) or folds a folder.
[+ File]/[+ Folder]— real clickable winbar buttons (%@handler@regions). The folder button doesmkdir -p, not the trailing-slash typing convention.- Right-click menu — plain-ASCII items (New file/folder, Open, Open in split, Rename, Cut, Copy, Paste, Delete), global-but-late mapping (mouse events route to the focused buffer's maps, so tree-local could never fire); outside the tree the stock right-click is re-fed untouched.
- Ctrl+click multi-select (marks, rendered
*), and drag-and-drop: drop a file on a folder to move it in; drag a marked row and the whole selection moves. A one-cell jitter is a click, not a drag — same trackpad rule as the rest of drill.
Bugs found on the way
- A mouse press from insert focuses the tree while staying in insert (measured: mode
"i", filetypeNvimTree), landing releases in a mode no tree mapping owns — every click silently ate itself. The tree now forces Normal on entry. <D-b>stops being the docs' example of a floored chord; the floor test re-spells with<D-g>.
Tests & plumbing
- New
tests/suite_tree.sh+tests/tree_drive.py: 45 cases on a real pty — both toggle chords (Cmd+B as raw CSI-u bytes), focus that never leaves your code, toolbar clicks all the way to files on disk, a menu item clicked by its float coordinates, marked-pair drag moves, and the 3-window REPL layout. tests/run.shgains avendor.shpreflight (CI needs zero workflow changes); gate grows 558 → 719 cases, all green locally (2 full runs).install.sh: manifest + vendor fetch (FEATURE-level; offline installs lose only the sidebar), nvim gate 0.9 → 0.10 (what the pinned nvim-tree requires). Verified in a sandboxedHOME.- Docs: README section, KEYS.md gestures, new
docs/explorer.md, honesty pass on every "no plugins" claim.
🤖 Generated with Claude Code
Summary by cubic
Adds an optional, vendored file-explorer sidebar on Ctrl+B/Cmd+B that loads only on first toggle. Old behavior: no plugins and the sidebar (when present) rooted at the shell’s working directory with possible user plugin leakage. New behavior: one opt‑in plugin (nvim-tree.lua + nvzone/volt + nvzone/menu) loads lazily, the tree roots at the current file’s folder on open, it keeps the existing root when toggled from the REPL or a scratch buffer, filesystem watchers stay disabled to avoid EMFILE, and both runtimepath and packpath seals block third‑party loads. Hiding the REPL now returns focus to a real typing buffer instead of the tree.
- Focus stays in the file window; single‑click opens/folds; real winbar “[+ File]” / “[+ Folder]”; right‑click menu only in the tree; Ctrl+click marks; drag‑and‑drop moves (marked sets move together); jitter is a click; entering the tree forces Normal; window picker excludes terminals. Netrw roots the tree at the directory it lists. Docs call out iTerm2’s right‑click Pointer binding that must be removed.
- Code review:
explorer.lualazy setup, drag/drop, menu, toolbar, rooting and watcher settings;nvimrc.luapath sealing, Ctrl+B/Cmd+B toggles, andrepl_hidefocus fix;vendor.shpinned checkouts;install.shrunsvendor.sh, adds agitdep, and enforces Neovim 0.10+;tests/run.shpreflightsvendor.sh; gate is 729 cases with 55 real‑PTY sidebar tests; docs updated.
Rollout
- Required: run
./vendor.shafter pulling; ensure Neovim 0.10+ andgitare installed. - macOS: enable Cmd forwarding; in iTerm2 remove the default right‑click Pointer binding so the tree menu works.
- No change if the sidebar is never toggled; netrw remains for directory listing.
Greptile Summary
The PR adds an optional, lazily loaded file-explorer sidebar and vendors its pinned plugin dependencies.
- Adds mouse-driven tree navigation, creation, context-menu, selection, and drag-and-drop behavior.
- Seals user site directories out of Neovim runtime and package paths.
- Extends installation, documentation, and PTY-based test coverage for the sidebar.
Confidence Score: 3/5
The PR is not yet safe to merge because vendor refresh failures can remove working sidebar dependencies and the installer rejects a still-documented supported Neovim version.
The existing vendor replacement path deletes each nonmatching checkout before fetching its replacement, and the installation contract still disagrees between the hard Neovim 0.10 gate and README’s 0.9+ prerequisite.
Files Needing Attention: vendor.sh, install.sh, README.md
Important Files Changed
| Filename | Overview |
|---|---|
| explorer.lua | Implements lazy sidebar setup, tree rooting, mouse gestures, toolbar actions, context menus, and drag-and-drop. |
| nvimrc.lua | Seals user plugin paths and adds lazy sidebar toggle mappings while preserving the isolated editor setup. |
| vendor.sh | Fetches three exact plugin revisions, but the previously reported destructive replacement sequence remains. |
| install.sh | Installs sidebar assets and dependencies, but its Neovim hard gate remains inconsistent with the documented prerequisite. |
| tests/suite_tree.sh | Adds real-PTY coverage for sidebar toggles, focus, mouse interactions, filesystem operations, and REPL layouts. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart LR
K[Ctrl+B or Cmd+B] --> L[Load explorer.lua]
L --> V[Add pinned vendor checkouts to runtimepath]
V --> T[Initialize nvim-tree and menu]
T --> U[Mouse-driven sidebar]
I[install.sh or tests/run.sh] --> F[vendor.sh]
F --> V
Reviews (3): Last reviewed commit: "Ctrl+E out of the REPL means the code, n..." | Re-trigger Greptile