File tree Expand file tree Collapse file tree 2 files changed +13
-2
lines changed
Expand file tree Collapse file tree 2 files changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -787,7 +787,8 @@ These defaults can be changed by setting the following options:
787787<
788788
789789In addition to `" tab" ` and `" window" ` , you can also set the target to `" global" `
790- for either option, which is the same as using the | cd | command.
790+ for either option, which is the same as using the | cd | command. Setting the target
791+ to `" none" ` will prevent neo-tree from setting vim's cwd for that position.
791792
792793
793794FILTERED ITEMS *neo-tree-filtered-items*
Original file line number Diff line number Diff line change @@ -302,6 +302,8 @@ local get_params_for_cwd = function(state)
302302 return winid , tabnr
303303 elseif target == " global" then
304304 return - 1 , - 1
305+ elseif target == " none" then
306+ return nil , nil
305307 else -- default to tab
306308 return - 1 , tabnr
307309 end
312314
313315M .get_cwd = function (state )
314316 local winid , tabnr = get_params_for_cwd (state )
315- local success , cwd = pcall (vim .fn .getcwd , winid , tabnr )
317+ local success , cwd = false , " "
318+ if winid or tabnr then
319+ success , cwd = pcall (vim .fn .getcwd , winid , tabnr )
320+ end
316321 if success then
317322 return cwd
318323 else
@@ -331,6 +336,11 @@ M.set_cwd = function(state)
331336 end
332337
333338 local winid , tabnr = get_params_for_cwd (state )
339+
340+ if winid == nil and tabnr == nil then
341+ return
342+ end
343+
334344 local _ , cwd = pcall (vim .fn .getcwd , winid , tabnr )
335345 if state .path ~= cwd then
336346 if winid > 0 then
You can’t perform that action at this time.
0 commit comments