Skip to content

Commit 089d0e4

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

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
@@ -214,8 +214,10 @@ end
214214

215215
---@param context YaziActiveContext
216216
function YaziOpenerActions.change_working_directory(context)
217+
local path = context.input_path
217218
local last_directory = context.ya_process.cwd
218-
if last_directory then
219+
or (path and path:parent().filename)
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)