partial clean support
This commit is contained in:
parent
f273080b19
commit
15b99738c7
@ -12,6 +12,8 @@ local pfiletype = require("plenary.filetype")
|
|||||||
local pickers = require("telescope.pickers")
|
local pickers = require("telescope.pickers")
|
||||||
local previewers = require("telescope.previewers")
|
local previewers = require("telescope.previewers")
|
||||||
local putils = require("telescope.previewers.utils")
|
local putils = require("telescope.previewers.utils")
|
||||||
|
local scan = require("plenary.scandir")
|
||||||
|
local Path = require("plenary.path")
|
||||||
|
|
||||||
local M = {}
|
local M = {}
|
||||||
|
|
||||||
@ -567,6 +569,30 @@ M.setup = function(config)
|
|||||||
setup_autocmds()
|
setup_autocmds()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
M.clean = function()
|
||||||
|
local decode = function(str)
|
||||||
|
if str == nil then
|
||||||
|
return ""
|
||||||
|
end
|
||||||
|
|
||||||
|
return str:gsub("+", " "):gsub(
|
||||||
|
"%%(%x%x)",
|
||||||
|
function(x)
|
||||||
|
return string.char(tonumber(x, 16))
|
||||||
|
end
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
local files = scan.scan_dir(haven_config.haven_path, {hidden = true, depth = 1})
|
||||||
|
for _, name in ipairs(files) do
|
||||||
|
name = decode(Path:new(name):make_relative(haven_config.haven_path)):sub(1, -6)
|
||||||
|
local p = Path:new(name)
|
||||||
|
if not p:exists() then
|
||||||
|
print(p:absolute())
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
M.disable = function()
|
M.disable = function()
|
||||||
if haven_config.enabled then
|
if haven_config.enabled then
|
||||||
haven_config.enabled = false
|
haven_config.enabled = false
|
||||||
|
Loading…
x
Reference in New Issue
Block a user