fix(nvim): Make Oil the reliable directory explorer#11
Conversation
- Disable netrw and defer directory takeover until BufEnter to avoid Oil startup parent-window races. - Route :Explore and :E through Oil while preserving the existing directory shortcuts. - Restore Oil’s directory winbar after winbar.nvim clears excluded filetype winbars.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 2 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit a408243. Configure here.
|
|
||
| vim.schedule(function() | ||
| oil.open(path) | ||
| end) |
There was a problem hiding this comment.
Scheduled Oil opens wrong window
Medium Severity
The directory BufEnter handler captures only path, then calls oil.open(path) inside vim.schedule. When the callback runs, Oil uses the then-current window, not the window that entered the directory buffer, so a quick buffer or window switch can open the explorer in the wrong place or trigger Oil errors.
Reviewed by Cursor Bugbot for commit a408243. Configure here.
| use_winbar = true, | ||
| }).str, | ||
| })) | ||
| end, {}) |
There was a problem hiding this comment.
Debug PrintWinbar command committed
Low Severity
A new :PrintWinbar user command dumps raw and rendered winbar values via vim.inspect and nvim_eval_statusline. It is not part of the Oil explorer behavior described in the PR and reads like temporary winbar debugging left in core/vim.lua.
Reviewed by Cursor Bugbot for commit a408243. Configure here.


Summary
Tickets
Note
Low Risk
Editor-only dotfile changes with no auth, data, or production runtime impact; main risk is personal workflow regressions if Oil or autocmds misbehave on edge cases.
Overview
Oil becomes the default directory explorer by disabling netrw in
init.luabefore plugins load, swapping outnetrw.nvimfor a fulloil.nvimsetup, and commenting out the netrw plugin.Startup and navigation set
default_file_explorer = falseand open directory buffers onBufEnterviaoil.open()so launching Neovim with a directory path avoids Oil’s parent-window race.:Exploreand:Eare redefined to calloil.open()(with optional path and dir completion), and-/<space>-open Oil in the buffer or float.Winbar excludes the
oilfiletype inwinbar.nvimand restores Oil’s custom winbar (get_oil_winbar) on several events so the directory path isn’t cleared by the global winbar plugin. APrintWinbaruser command was added for debugging winbar rendering.Reviewed by Cursor Bugbot for commit a408243. Configure here.