Skip to content

fix: don't disable netrw entirely (breaks spell-file downloads) - #753

Open
Booyaka101 wants to merge 1 commit into
stevearc:masterfrom
Booyaka101:fix/483-spell-file-download
Open

fix: don't disable netrw entirely (breaks spell-file downloads)#753
Booyaka101 wants to merge 1 commit into
stevearc:masterfrom
Booyaka101:fix/483-spell-file-download

Conversation

@Booyaka101

Copy link
Copy Markdown

Closes #483.

oil.setup() set g:loaded_netrw / g:loaded_netrwPlugin to keep netrw from taking over directory buffers. That also blocks unrelated netrw plumbing that the runtime depends on:

  • spellfile#LoadFile uses netrw's :Nread to fetch missing spell files, so :set spelllang=es shows "Cannot find word list" instead of the download prompt.
  • gx, scp://, http:// editing, and other netrw integrations silently break.

Oil's BufAdd handler renames directory buffers to oil:// form, which makes every netrw isdirectory() check return false on its own. Clearing netrw's FileExplorer augroup (the only thing netrw uses to take over directory buffers) is enough; the loaded_netrw flags were redundant.

The clear runs synchronously at oil.setup() time (covers the case where netrw was already loaded before oil) and again on a one-shot VimEnter autocmd (covers the common case where netrw's runtime plugin loads after init.lua but before files are opened).

Includes a regression test that fails on the previous code and passes here.

Setting g:loaded_netrw / g:loaded_netrwPlugin in oil.setup() blocked
netrw plumbing that the runtime depends on for things unrelated to
directory browsing:

- spellfile#LoadFile uses netrw's :Nread to fetch missing spell files,
  so :set spelllang=es shows "Cannot find word list" instead of the
  download prompt.
- gx, scp://, http:// editing, and other netrw integrations silently
  break.

Oil's BufAdd handler renames directory buffers to oil:// form, which
makes every netrw isdirectory() check return false on its own. Clearing
netrw's FileExplorer augroup (the only thing it uses to take over
directory buffers) is enough; the loaded_netrw flags were redundant.

Closes stevearc#483.
@github-actions
github-actions Bot requested a review from stevearc May 20, 2026 16:29
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.

bug: Cannot download spell language filies after installing Oil

1 participant