Skip to content

fix: use input dir if needed when changing cwd #487

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Oct 2, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
fix: use input dir if needed when changing cwd
  • Loading branch information
chenxin-yan committed Sep 26, 2024
commit 089d0e4b8b50c412ff4313ec9a70218ab527f5d1
4 changes: 3 additions & 1 deletion lua/yazi/keybinding_helpers.lua
Original file line number Diff line number Diff line change
@@ -214,8 +214,10 @@ end

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