refactoring

This commit is contained in:
Scott E. Graves 2022-07-29 23:46:56 -05:00
parent ccc14e0fa9
commit f273080b19

View File

@ -17,45 +17,46 @@ local M = {}
local active_saves = {} local active_saves = {}
local changed_lookup = {} local changed_lookup = {}
local directory_sep = g.iff(gos.is_windows, "\\", "/")
local haven_config = { local haven_config = {
enabled = true, enabled = true,
exclusions = { exclusions = {
function(path, _) function(path, _)
if gos.is_windows then if gos.is_windows then
return path:lower():starts_with((vim.fn.eval("$VIMRUNTIME") .. directory_sep):lower()) return path:lower():starts_with((vim.fn.eval("$VIMRUNTIME") .. gpath.directory_sep):lower())
end end
return path:starts_with(vim.fn.eval("$VIMRUNTIME") .. directory_sep) return path:starts_with(vim.fn.eval("$VIMRUNTIME") .. gpath.directory_sep)
end, end,
function(path, _) function(path, _)
if gos.is_windows then if gos.is_windows then
return path:lower():starts_with((vim.fn.stdpath("data") .. directory_sep):lower()) return path:lower():starts_with((vim.fn.stdpath("data") .. gpath.directory_sep):lower())
end end
return path:starts_with(vim.fn.stdpath("data") .. directory_sep) return path:starts_with(vim.fn.stdpath("data") .. gpath.directory_sep)
end, end,
function(path, _) function(path, _)
if gos.is_windows then if gos.is_windows then
return path:lower():starts_with( return path:lower():starts_with(
(gpath.create_path(vim.fn.eval("$XDG_CONFIG_HOME"), "coc") .. directory_sep):lower() (gpath.create_path(vim.fn.eval("$XDG_CONFIG_HOME"), "coc") .. gpath.directory_sep):lower()
) )
end end
return path:starts_with( return path:starts_with(
gpath.create_path(vim.fn.eval("$XDG_CONFIG_HOME"), "coc") .. directory_sep gpath.create_path(vim.fn.eval("$XDG_CONFIG_HOME"), "coc") .. gpath.directory_sep
) )
end, end,
function(path, _) function(path, _)
if gos.is_windows then if gos.is_windows then
return path:lower():ends_with( return path:lower():ends_with(
(directory_sep .. ".git" .. directory_sep .. "COMMIT_EDITMSG"):lower() (gpath.directory_sep .. ".git" .. gpath.directory_sep .. "COMMIT_EDITMSG"):lower()
) )
end end
return path:ends_with(directory_sep .. ".git" .. directory_sep .. "COMMIT_EDITMSG") return path:ends_with(
gpath.directory_sep .. ".git" .. gpath.directory_sep .. "COMMIT_EDITMSG"
)
end, end,
function(path, config) function(path, config)
if gos.is_windows then if gos.is_windows then
return path:lower():starts_with((config.haven_path .. directory_sep):lower()) return path:lower():starts_with((config.haven_path .. gpath.directory_sep):lower())
end end
return path:starts_with(config.haven_path .. directory_sep) return path:starts_with(config.haven_path .. gpath.directory_sep)
end end
}, },
haven_path = gpath.create_path(vim.fn.stdpath("data"), "nvim-haven"), haven_path = gpath.create_path(vim.fn.stdpath("data"), "nvim-haven"),