mirror of
https://github.com/folke/snacks.nvim
synced 2025-08-04 10:49:08 +00:00
feat(explorer): added git status. Closes #817
This commit is contained in:
parent
09bf19f15b
commit
5cae48d93c
11 changed files with 278 additions and 32 deletions
|
@ -411,4 +411,19 @@ function M.pick_win(opts)
|
|||
end
|
||||
end
|
||||
|
||||
---@param path string
|
||||
---@param cwd? string
|
||||
---@return fun(): string?
|
||||
function M.parents(path, cwd)
|
||||
cwd = cwd or uv.cwd()
|
||||
if not (cwd and path:sub(1, #cwd) == cwd and #path > #cwd) then
|
||||
return function() end
|
||||
end
|
||||
local to = #cwd + 1 ---@type number?
|
||||
return function()
|
||||
to = path:find("/", to + 1, true)
|
||||
return to and path:sub(1, to - 1) or nil
|
||||
end
|
||||
end
|
||||
|
||||
return M
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue