1
This commit is contained in:
Alex Yatskov 2023-01-26 17:13:44 -08:00
parent 4e9385844f
commit 340cb2d8e7

View File

@ -12,12 +12,16 @@ local function setup(config)
end
end
local function escape(s)
return s:gsub('[%-%.%+%[%]%(%)%$%^%%%?%*]','%%%1')
end
local function file_exists(path)
return vim.loop.fs_stat(path) ~= nil
end
local function path_pivot(path, suffix)
local start, stop = path:find(suffix)
local start, stop = path:find(escape(suffix) .. '$')
if start and stop == #path then
return path:sub(0, start - 1)
end