-
Notifications
You must be signed in to change notification settings - Fork 14
Expand file tree
/
Copy pathjdtls.lua
More file actions
35 lines (32 loc) · 975 Bytes
/
jdtls.lua
File metadata and controls
35 lines (32 loc) · 975 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
local utils = require("kide.core.utils")
local M = {}
local function delete_file(hf)
local files = vim.fn.system("fd -I -H " .. hf .. "$")
if files and files ~= "" then
for file in string.gmatch(files, "[^\r\n]+") do
vim.fn.system("rm -rf " .. file)
end
return files
end
end
-- fd -I -H settings$ | xargs rm -rf
-- fd -I -H classpath$ | xargs rm -rf
-- fd -I -H project$ | xargs rm -rf
-- fd -I -H factorypath$ | xargs rm -rf
local function clean_jdtls()
local del_files = delete_file("settings") or ""
del_files = del_files .. (delete_file("classpath") or "")
del_files = del_files .. (delete_file("project") or "")
del_files = del_files .. (delete_file("factorypath") or "")
vim.notify("delete: \n" .. del_files, vim.log.levels.INFO)
end
M.setup = function()
if utils.is_mac or utils.is_linux then
vim.api.nvim_create_user_command("CleanJdtls", function()
clean_jdtls()
end, {
nargs = 0,
})
end
end
return M