feat(compat): added svim, a compatibility layer for Neovim. Closes #1321

This commit is contained in:
Folke Lemaitre 2025-02-20 06:56:47 +01:00
parent 7d10a38c44
commit bc902f7032
No known key found for this signature in database
GPG key ID: 41F8B1FBACAE2040
37 changed files with 133 additions and 90 deletions

View file

@ -29,7 +29,7 @@ end
function M.get_root(path)
path = path or 0
path = type(path) == "number" and vim.api.nvim_buf_get_name(path) or path --[[@as string]]
path = vim.fs.normalize(path)
path = svim.fs.normalize(path)
path = path == "" and (vim.uv or vim.loop).cwd() or path
local todo = { path } ---@type string[]
@ -40,13 +40,13 @@ function M.get_root(path)
-- check cache first
for _, dir in ipairs(todo) do
if git_cache[dir] then
return vim.fs.normalize(dir) or nil
return svim.fs.normalize(dir) or nil
end
end
for _, dir in ipairs(todo) do
if is_git_root(dir) then
return vim.fs.normalize(dir) or nil
return svim.fs.normalize(dir) or nil
end
end