17 Commits

Author SHA1 Message Date
Barrett Ruth
9edf57e665 fix(dir): custom 3P directory-browser #40725
Problem:
Third-party directory browsers do not have a documented way to take over local
directory buffers from nvim.dir.

Solution:
Document deleting the nvim.dir augroup and handling FileType directory as the
after-startup handoff, and avoid installing the built-in buffer-local "-" mapping
when "-" is already mapped.
2026-07-16 14:26:01 -04:00
Barrett Ruth
73bb6a8a5e fix(dir): let 3P dir-browser plugin rename the dir buffer #40529
Problem:
`FileType directory` fires *before* the `BufEnter` path where `dir.lua`
populates the buffer, in order to allow a 3P dir-browser plugin to handle the
event and (optionally) rename the buffer to e.g. `example:///tmp/foo/`.

But currently, `open_buffer()` continues after `filetypedetect BufRead` as if
the original directory buffer is *still* current and valid, which may fall
through to the built-in `nvim.dir` path after a 3P plugin ALREADY handled the
directory.

Solution:
Keep a buf ref around the early `filetypedetect BufRead` call for directory
buffers.

If the `FileType directory` handler switches away from/deletes the original
directory buffer, stop the open path instead of continuing into the built-in
`nvim.dir` flow.
2026-07-13 15:10:19 -04:00
Barrett Ruth
1665b992b7 fix(filetype): trigger FileType after BufReadCmd #40679
Problem:
A successful `BufReadCmd` can leave an existing `filetype` without
rerunning its `FileType` setup, so state cleared during reload may not
be restored.

This also causes `:edit`/reload syntax `directoryDirectory` groups to
not be reapplied.

Solution:
After `BufReadCmd` handles a read, trigger `FileType` for the existing
`filetype` if no `FileType` event fired during the read.
2026-07-13 09:08:09 -04:00
Justin M. Keyes
f1904f2a6c test(dir): "replace - mapping" hangs the Windows CI 2026-07-11 14:09:05 +02:00
Barrett Ruth
3b88a8a65d fix(filetype): ensure directory bufname ends w/ slash sep #40552
Problem:
`vim.filetype.match()` needs a cheap way to recognize directory buffers
without doing filesystem stat work.

Solution:
Ensure full buffer names for directories end in a trailing slash. Now
directory buffers can proceed through the normal 'filetype' path.

Note side-effects: session and ShaDa buffer-list restore behavior must
be compatible, so those + corresponding tests must be updated.
2026-07-10 12:40:13 -04:00
Barrett Ruth
20a4b1bc5e fix(dir): user/plugin can override default "-" mapping #40676 2026-07-10 11:52:24 -04:00
Barrett Ruth
7dccbfed10 fix(dir): select origin on parent navigation #40658 2026-07-09 17:47:56 -04:00
Barrett Ruth
a54a7f6a78 fix(dir): preserve alternate buffer #40659 2026-07-09 15:41:09 -04:00
bfredl
349f810eed refactor(test): unify XDG path handling (cmake vs zig)
fixes #40381
2026-07-06 10:55:20 +02:00
Barrett Ruth
7325e3b55a fix(dir): define "-" (up/parent) mapping earlier #40531
Problem:
The dir.lua "-" mapping cannot be easily overridden (because of autocmd
ordering).

Solution:
- Move it to defaults.lua.
- Also to be extra polite: fall back to builtin `-` motion if the user
  disabled the `dir.lua` plugin.
2026-07-02 15:55:48 -04:00
Barrett Ruth
daa229bfde fix(dir): restore loaded plugin guard #40528 2026-07-01 14:45:55 -04:00
Barrett Ruth
784ab9edfb fix(dir): reload listing on :edit #40496 2026-06-30 14:19:53 -04:00
Barrett Ruth
1b959ba485 fix(dir): remove loaded plugin guard #40489 2026-06-30 07:54:36 -04:00
Barrett Ruth
9202e2c80c fix(dir): respect directory buffer lifetime #40453
Problem:
dir.lua leaves previously-navigated directory buffers around.
This is fine by default, but users need a simple way to opt out.

Solution:
1. Respect `set hidden` (via `'bufhidden'`) as one way to make
   previously-navigated dir buffers from showing up.
2. Document a one-liner to hide these buffers
2026-06-27 14:08:28 -04:00
Barrett Ruth
6576e75eeb feat(dir.lua): global "-" default mapping #40426 2026-06-26 06:17:00 -04:00
Barrett Ruth
ac82dd3348 test(runtime): exercise dir.lua on Windows #40423 2026-06-25 22:20:03 +00:00
Barrett Ruth
bf917a503a feat(runtime): replace netrw with a very small script #39723
Problem:
`:edit <dir>` and `nvim <dir>` currently rely on netrw to show local directory
contents.

Solution:
- Provide `filetype=directory`.
- Introduce dir.lua, a small plugin that provides directory listing, opening
  items, parent navigation, and refresh.
- `netrw` remains available for `:Explore`, remote paths, archives, and file
  operations. To continue 

Co-authored-by: Justin M. Keyes <justinkz@gmail.com>
2026-06-25 17:31:18 -04:00