Skip to content

Commit

Permalink
fix: use input dir if needed when changing cwd
Browse files Browse the repository at this point in the history
  • Loading branch information
chenxin-yan committed Sep 26, 2024
1 parent 36d0174 commit 8bbfecd
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lua/yazi/keybinding_helpers.lua
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,9 @@ end
---@param context YaziActiveContext
function YaziOpenerActions.change_working_directory(context)
local last_directory = context.ya_process.cwd
if last_directory then
or context.input_path:parent().filename
or nil
if last_directory and last_directory ~= vim.fn.getcwd() then
vim.notify('cwd changed to "' .. last_directory .. '"')
vim.cmd({ cmd = "cd", args = { last_directory } })
end
Expand Down

0 comments on commit 8bbfecd

Please sign in to comment.