Skip to content

Commit 178ba98

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

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

lua/yazi/keybinding_helpers.lua

+2-1
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,8 @@ 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+
if last_directory and last_directory ~= vim.fn.getcwd() then
219220
vim.notify('cwd changed to "' .. last_directory .. '"')
220221
vim.cmd({ cmd = "cd", args = { last_directory } })
221222
end

0 commit comments

Comments
 (0)