mirror of
https://github.com/folke/snacks.nvim
synced 2025-12-23 08:47:57 +00:00
feat(compat): added svim, a compatibility layer for Neovim. Closes #1321
This commit is contained in:
parent
7d10a38c44
commit
bc902f7032
37 changed files with 133 additions and 90 deletions
|
|
@ -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
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue