File tree 1 file changed +3
-5
lines changed
1 file changed +3
-5
lines changed Original file line number Diff line number Diff line change 485
485
--- @param size number ?
486
486
--- @param direction string ?
487
487
function Terminal :open (size , direction )
488
- self .dir = _get_dir (self .dir )
488
+ local cwd = fn .getcwd ()
489
+ self .dir = _get_dir (config .autochdir and cwd or self .dir )
489
490
ui .set_origin_window ()
490
491
if direction then self :change_direction (direction ) end
491
492
if not self .bufnr or not api .nvim_buf_is_valid (self .bufnr ) then
@@ -496,10 +497,7 @@ function Terminal:open(size, direction)
496
497
local ok , err = pcall (opener , size , self )
497
498
if not ok and err then return utils .notify (err , " error" ) end
498
499
ui .switch_buf (self .bufnr )
499
- if config .autochdir then
500
- local cwd = fn .getcwd ()
501
- if self .dir ~= cwd then self :change_dir (cwd ) end
502
- end
500
+ if config .autochdir and self .dir ~= cwd then self :change_dir (cwd ) end
503
501
end
504
502
ui .hl_term (self )
505
503
-- NOTE: it is important that this function is called at this point. i.e. the buffer has been correctly assigned
You can’t perform that action at this time.
0 commit comments