fix: don't disable netrw entirely (breaks spell-file downloads) - #753
Open
Booyaka101 wants to merge 1 commit into
Open
fix: don't disable netrw entirely (breaks spell-file downloads)#753Booyaka101 wants to merge 1 commit into
Booyaka101 wants to merge 1 commit into
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #483.
oil.setup()setg:loaded_netrw/g:loaded_netrwPluginto keep netrw from taking over directory buffers. That also blocks unrelated netrw plumbing that the runtime depends on:spellfile#LoadFileuses netrw's:Nreadto fetch missing spell files, so:set spelllang=esshows "Cannot find word list" instead of the download prompt.gx,scp://,http://editing, and other netrw integrations silently break.Oil's
BufAddhandler renames directory buffers tooil://form, which makes every netrwisdirectory()check return false on its own. Clearing netrw'sFileExploreraugroup (the only thing netrw uses to take over directory buffers) is enough; theloaded_netrwflags 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-shotVimEnterautocmd (covers the common case where netrw's runtime plugin loads afterinit.luabut before files are opened).Includes a regression test that fails on the previous code and passes here.