File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -206,10 +206,10 @@ end
206206
207207--- Change Neovim's working directory to path, e.g. when Crush switches
208208--- the active worktree so the editor follows the agent into the new
209- --- tree. Uses tab-local :tcd so a switch only affects the current tab
210- --- (leaving other tabs' cwd intact), falling back to global :cd if tcd
211- --- is unavailable. Best-effort: never raises, and silently ignores a
212- --- missing/empty path or a directory that no longer exists.
209+ --- tree. Uses global :cd so the change is instance-wide: new buffers,
210+ --- :terminal jobs, and floating terminals all spawn in the worktree.
211+ --- Best-effort: never raises, and silently ignores a missing/empty path
212+ --- or a directory that no longer exists.
213213--- @param path string absolute directory path
214214function M .set_cwd (path )
215215 if path == nil or path == ' ' then
@@ -221,10 +221,7 @@ function M.set_cwd(path)
221221 return
222222 end
223223 -- Quote against spaces/specials in the path.
224- local quoted = vim .fn .fnameescape (dir )
225- if not pcall (vim .cmd , ' tcd ' .. quoted ) then
226- pcall (vim .cmd , ' cd ' .. quoted )
227- end
224+ pcall (vim .cmd , ' cd ' .. vim .fn .fnameescape (dir ))
228225 end )
229226end
230227
You can’t perform that action at this time.
0 commit comments