Skip to content

fix(nvim): Make Oil the reliable directory explorer#11

Merged
Unique-Divine merged 1 commit into
mainfrom
ud/nvim
Jul 13, 2026
Merged

fix(nvim): Make Oil the reliable directory explorer#11
Unique-Divine merged 1 commit into
mainfrom
ud/nvim

Conversation

@Unique-Divine

@Unique-Divine Unique-Divine commented Jul 13, 2026

Copy link
Copy Markdown
Owner

Summary

  • 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.

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.lua before plugins load, swapping out netrw.nvim for a full oil.nvim setup, and commenting out the netrw plugin.

Startup and navigation set default_file_explorer = false and open directory buffers on BufEnter via oil.open() so launching Neovim with a directory path avoids Oil’s parent-window race. :Explore and :E are redefined to call oil.open() (with optional path and dir completion), and - / <space>- open Oil in the buffer or float.

Winbar excludes the oil filetype in winbar.nvim and restores Oil’s custom winbar (get_oil_winbar) on several events so the directory path isn’t cleared by the global winbar plugin. A PrintWinbar user command was added for debugging winbar rendering.

Reviewed by Cursor Bugbot for commit a408243. Configure here.

- 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.

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using default effort and found 2 potential issues.

Fix All in Cursor

❌ 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)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit a408243. Configure here.

Comment thread nvim/lua/core/vim.lua
use_winbar = true,
}).str,
}))
end, {})

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit a408243. Configure here.

@Unique-Divine
Unique-Divine merged commit 26abdea into main Jul 13, 2026
2 checks passed
@Unique-Divine
Unique-Divine deleted the ud/nvim branch July 13, 2026 03:07
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.

Oil directory winbar is cleared by winbar.nvim Neovim startup warns that Oil cannot find its parent window

1 participant