mirror of
https://github.com/LazyVim/LazyVim.git
synced 2026-07-22 12:31:07 +00:00
fix(util.root): resolve bufpath for terminal windows
Extract path from terminal window name such as `term:/~/.local/share/nvim/lazy/LazyVim/2062833:/usr/bin/zsh`. The path `~/.local/share/nvim/lazy/LazyVim/2062833` can locate the correct directory for the terminal windows.
This commit is contained in:
parent
96f4f18d7d
commit
3f2c1c41e6
1 changed files with 3 additions and 1 deletions
|
|
@ -67,7 +67,9 @@ function M.detectors.pattern(buf, patterns)
|
|||
end
|
||||
|
||||
function M.bufpath(buf)
|
||||
return M.realpath(vim.api.nvim_buf_get_name(assert(buf)))
|
||||
local path = LazyVim.norm(vim.api.nvim_buf_get_name(assert(buf)))
|
||||
-- Use pattern to extract path for terminal windows
|
||||
return M.realpath(path and path:match("^term:/([^:]+)") or path)
|
||||
end
|
||||
|
||||
function M.cwd()
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue