mirror of
https://github.com/neovim/neovim.git
synced 2026-08-27 17:41:48 +00:00
fix(dir): :browse edit opens dir browser #40930
Problem: `:browse edit` (and variants) without an argument fails instead of opening a browser. Solution: Dispatch to dir.lua using the cwd as the implied directory. Replace the inherited GUI-only documentation with the supported behavior. Support vsplit, split, tabedit variants.
This commit is contained in:
@@ -683,19 +683,29 @@ describe('nvim.dir', function()
|
||||
eq('netrw', api.nvim_get_option_value('filetype', { buf = 0 }))
|
||||
end)
|
||||
|
||||
it('supports the FileExplorer browse contract', function()
|
||||
if t.is_zig_build() then
|
||||
return pending('broken with build.zig: TMPDIR relative cwd')
|
||||
end
|
||||
make_fixture()
|
||||
n.clear({ args_rm = { '-u' } })
|
||||
local cwd = fn.getcwd()
|
||||
for _, case in ipairs({
|
||||
{ command = 'edit', windows = 1, tabs = 1 },
|
||||
{ command = 'split', windows = 2, tabs = 1 },
|
||||
{ command = 'vsplit', windows = 2, tabs = 1 },
|
||||
{ command = 'tabedit', windows = 1, tabs = 2 },
|
||||
{ command = 'tabnew', windows = 1, tabs = 2 },
|
||||
}) do
|
||||
it(('":browse %s"'):format(case.command), function()
|
||||
if t.is_zig_build() then
|
||||
return pending('broken with build.zig: TMPDIR relative cwd')
|
||||
end
|
||||
make_fixture()
|
||||
n.clear({ args_rm = { '-u' } })
|
||||
local cwd = fn.getcwd()
|
||||
|
||||
cd(root)
|
||||
command('browse edit .')
|
||||
cd(cwd)
|
||||
cd(root)
|
||||
command('browse ' .. case.command)
|
||||
cd(cwd)
|
||||
|
||||
assert_directory(root)
|
||||
line_of('alpha.txt')
|
||||
end)
|
||||
eq(case.windows, #api.nvim_tabpage_list_wins(0))
|
||||
eq(case.tabs, #api.nvim_list_tabpages())
|
||||
assert_directory(root)
|
||||
line_of('alpha.txt')
|
||||
end)
|
||||
end
|
||||
end)
|
||||
|
||||
Reference in New Issue
Block a user