From 1b959ba48504aedd228ca9fa5f1c0db889d2422e Mon Sep 17 00:00:00 2001
From: Barrett Ruth <62671086+barrettruth@users.noreply.github.com>
Date: Tue, 30 Jun 2026 06:54:36 -0500
Subject: [PATCH] fix(dir): remove loaded plugin guard #40489
---
runtime/doc/plugins.txt | 5 -----
runtime/lua/nvim/dir.lua | 3 ---
runtime/plugin/dir.lua | 5 -----
test/functional/plugin/dir_spec.lua | 9 +--------
4 files changed, 1 insertion(+), 21 deletions(-)
diff --git a/runtime/doc/plugins.txt b/runtime/doc/plugins.txt
index a9597b6a88..95616834d2 100644
--- a/runtime/doc/plugins.txt
+++ b/runtime/doc/plugins.txt
@@ -71,11 +71,6 @@ after use: >vim
<
Use "wipe" to discard all buffer state; see 'bufhidden'.
- *g:loaded_nvim_dir_plugin*
-To disable this plugin, set this in your config before startup: >lua
- vim.g.loaded_nvim_dir_plugin = 1
-<
-
==============================================================================
Builtin plugin: difftool *difftool*
diff --git a/runtime/lua/nvim/dir.lua b/runtime/lua/nvim/dir.lua
index 3d2eff4d9b..69884af1dc 100644
--- a/runtime/lua/nvim/dir.lua
+++ b/runtime/lua/nvim/dir.lua
@@ -1,8 +1,5 @@
--- @brief
--- Directory listing for `:edit
`.
----
---- [g:loaded_nvim_dir_plugin]()
---- The plugin can be disabled by setting `g:loaded_nvim_dir_plugin = 1`.
local api = vim.api
local fs = vim.fs
diff --git a/runtime/plugin/dir.lua b/runtime/plugin/dir.lua
index f89804dcee..f17ed194d1 100644
--- a/runtime/plugin/dir.lua
+++ b/runtime/plugin/dir.lua
@@ -1,8 +1,3 @@
-if vim.g.loaded_nvim_dir_plugin ~= nil then
- return
-end
-vim.g.loaded_nvim_dir_plugin = true
-
local api = vim.api
local nvim_on = require('vim._core.util').nvim_on
diff --git a/test/functional/plugin/dir_spec.lua b/test/functional/plugin/dir_spec.lua
index 40b5855c6d..831c32fafc 100644
--- a/test/functional/plugin/dir_spec.lua
+++ b/test/functional/plugin/dir_spec.lua
@@ -352,7 +352,7 @@ describe('nvim.dir', function()
eq('', api.nvim_get_option_value('filetype', { buf = 0 }))
end)
- it('coexists with netrw and can be disabled', function()
+ it('coexists with netrw', function()
if t.is_zig_build() then
return pending('broken with build.zig relative runtime paths after chdir')
end
@@ -368,13 +368,6 @@ describe('nvim.dir', function()
command('Explore .')
cd(cwd)
eq('netrw', api.nvim_get_option_value('filetype', { buf = 0 }))
-
- n.clear({
- args_rm = { '-u' },
- args = { '--cmd', 'let g:loaded_nvim_dir_plugin = 1' },
- })
- edit(root)
- eq('netrw', api.nvim_get_option_value('filetype', { buf = 0 }))
end)
it('supports the FileExplorer browse contract', function()