feat(dir): support counts for parent navigation #40927

This commit is contained in:
Barrett Ruth
2026-07-24 03:48:47 -07:00
committed by GitHub
parent ce9cc43f23
commit 5d76b9836a
2 changed files with 19 additions and 2 deletions

View File

@@ -348,7 +348,7 @@ describe('nvim.dir', function()
eq('new:2', exec_lua('return vim.g.nvim_dir_provider_list'))
end)
it('maps - to open parent directories', function()
it('maps [count]- to open parent directories', function()
make_fixture()
n.clear({ args_rm = { '-u', '--cmd' } })
@@ -361,6 +361,20 @@ describe('nvim.dir', function()
-- Ensure the cursor stays on the entry we navigated up from.
eq('alpha.txt', api.nvim_get_current_line())
edit(file)
feed('1-')
poke_eventloop()
assert_directory(root)
eq('alpha.txt', api.nvim_get_current_line())
edit(file)
feed('2-')
poke_eventloop()
assert_directory(vim.fs.dirname(root))
eq(vim.fs.basename(root) .. '/', api.nvim_get_current_line())
end)
it('maps - to open the current directory from an unnamed buffer', function()