according to the documentation i setting the dir option to git_dir in neovim commandline likeToggleTerm dir=git_dir, but the directory in toggleterm does not change as expected
Expected Behavior
this seems to be caused by vim.fn.isdirectory not recognizing git_dir. i find the function that toggleterm.nvim used to get or create terminal
function M.get_or_create_term(num, dir, direction, name)
local term = M.get(num)
if term then return term, false end
if dir and fn.isdirectory(fn.expand(dir)) == 0 then dir = nil end
return Terminal:new({ id = num, dir = dir, direction = direction, display_name = name }), true
end
and find it depend vim.fn.isdirectory() to recognize directory, but git_dir will be not recognized.
Edited:
I added an additional if condition in my local toggleterm.nvim, which made ToggleTerm dir=git_dir work properly. I'm not sure if this will affect other behaviors.
function M.get_or_create_term(num, dir, direction, name)
local term = M.get(num)
if term then return term, false end
-- HACK: `dir ~= "git_dir"` is a hack to make git_dir work
if dir and fn.isdirectory(fn.expand(dir)) == 0 and dir ~= "git_dir" then dir = nil end
return Terminal:new({ id = num, dir = dir, direction = direction, display_name = name }), true
end
Steps To Reproduce
i set toggleterm.nvim in my configuration like this
Is there an existing issue for this?
Current Behavior
according to the documentation i setting the
dir
option togit_dir
in neovim commandline likeToggleTerm dir=git_dir
, but the directory in toggleterm does not change as expectedExpected Behavior
this seems to be caused by vim.fn.isdirectory not recognizing git_dir. i find the function that toggleterm.nvim used to get or create terminal
and find it depend
vim.fn.isdirectory()
to recognize directory, butgit_dir
will be not recognized.Edited: I added an additional if condition in my local
toggleterm.nvim
, which madeToggleTerm dir=git_dir
work properly. I'm not sure if this will affect other behaviors.Steps To Reproduce
i set toggleterm.nvim in my configuration like this
Environment
Anything else?
No response