Skip to content

Commit 8bbfecd

Browse files
committed
fix: use input dir if needed when changing cwd
1 parent 36d0174 commit 8bbfecd

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lua/yazi/keybinding_helpers.lua

+3-1
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,9 @@ end
215215
---@param context YaziActiveContext
216216
function YaziOpenerActions.change_working_directory(context)
217217
local last_directory = context.ya_process.cwd
218-
if last_directory then
218+
or context.input_path:parent().filename
219+
or nil
220+
if last_directory and last_directory ~= vim.fn.getcwd() then
219221
vim.notify('cwd changed to "' .. last_directory .. '"')
220222
vim.cmd({ cmd = "cd", args = { last_directory } })
221223
end

0 commit comments

Comments
 (0)