|
4 | 4 | local dependencies = {} |
5 | 5 |
|
6 | 6 | -- Ripgrep cmd and name |
7 | | -local ripgrep = { cmd = 'rg', name = 'ripgrep', |
8 | | - install_method = string.format('sudo apt install %s', 'ripgrep')} |
9 | | -table.insert(dependencies, ripgrep) |
| 7 | +table.insert(dependencies, { cmd = "rg", name = "ripgrep", install_method = string.format("sudo apt install %s", "ripgrep") }) |
10 | 8 | -- Curl cmd |
11 | | -local curl = {cmd = 'curl', name = 'curl', |
12 | | - install_method = string.format('sudo apt install %s', 'curl')} |
13 | | -table.insert(dependencies, curl) |
| 9 | +table.insert(dependencies, { cmd = "curl", name = "curl", install_method = string.format("sudo apt install %s", "curl") }) |
14 | 10 | -- lua |
15 | | -local lua = {cmd = 'lua', name = 'lua', |
16 | | - install_method = string.format('sudo apt install %s', 'lua')} |
17 | | -table.insert(dependencies, lua) |
| 11 | +table.insert(dependencies, { cmd = "lua", name = "lua", install_method = string.format("sudo apt install %s", "lua") }) |
18 | 12 | -- luarocks |
19 | | -local luarocks = {cmd = 'luarocks', name = 'luarocks', |
20 | | - install_method = string.format('sudo apt install %s', 'luarocks')} |
21 | | -table.insert(dependencies, luarocks) |
| 13 | +table.insert(dependencies, { cmd = "luarocks", name = "luarocks", install_method = string.format("sudo apt install %s", "luarocks") }) |
22 | 14 | -- git |
23 | | -local git = {cmd = 'git', name = 'git', |
24 | | - install_method = string.format('sudo apt install %s', 'git')} |
25 | | -table.insert(dependencies, git) |
| 15 | +table.insert(dependencies, { cmd = "git", name = "git", install_method = string.format("sudo apt install %s", "git") }) |
26 | 16 | -- python |
27 | | -local python = {cmd = 'python', name = 'python', |
28 | | - install_method = string.format('sudo apt install %s3.12', 'python')} |
29 | | -table.insert(dependencies, python) |
| 17 | +table.insert(dependencies, { cmd = "python", name = "python", install_method = string.format("sudo apt install %s3.12", "python") }) |
30 | 18 | -- pip |
31 | | -local pip = {cmd = 'pip', name = 'pip', |
32 | | - install_method = string.format('sudo apt install python3-%s', 'pip')} |
33 | | -table.insert(dependencies, pip) |
| 19 | +table.insert(dependencies, { cmd = "pip", name = "pip", install_method = string.format("sudo apt install python3-%s", "pip") }) |
34 | 20 | -- npm |
35 | | -local npm = {cmd = 'npm', name = 'npm', |
36 | | - install_method = string.format('sudo apt install %s', 'npm')} |
37 | | -table.insert(dependencies, npm) |
| 21 | +table.insert(dependencies, { cmd = "npm", name = "npm", install_method = string.format("sudo apt install %s", "npm") }) |
38 | 22 | -- fdfind |
39 | | -local fdfind = {cmd = 'fdfind', name = 'fd-find', |
40 | | - install_method = string.format('sudo apt install %s', 'fd-find')} |
41 | | -table.insert(dependencies, fdfind) |
| 23 | +table.insert(dependencies, { cmd = "fdfind", name = "fd-find", install_method = string.format("sudo apt install %s", "fd-find") }) |
42 | 24 |
|
43 | 25 | local attempt_cmd = function(opts) |
44 | | - if vim.fn.executable(opts.cmd) == 1 then |
45 | | - vim.health.ok(("Installed: %s"):format(opts.name)) |
46 | | - else |
47 | | - vim.health.warn(("Missing: %s"):format(opts.name)) |
48 | | - vim.health.info(opts.install_method) |
49 | | - end |
| 26 | + if vim.fn.executable(opts.cmd) == 1 then |
| 27 | + vim.health.ok(("Installed: %s"):format(opts.name)) |
| 28 | + else |
| 29 | + vim.health.warn(("Missing: %s"):format(opts.name)) |
| 30 | + vim.health.info(opts.install_method) |
| 31 | + end |
50 | 32 | end |
51 | 33 |
|
52 | 34 | local checkversion = function() |
53 | | - local versionstring = tostring(vim.version()) |
| 35 | + local versionstring = tostring(vim.version()) |
54 | 36 |
|
55 | | - if not vim.version.ge then |
56 | | - vim.health.error("Nvim out of date") |
57 | | - end |
| 37 | + if not vim.version.ge then |
| 38 | + vim.health.error("Nvim out of date") |
| 39 | + end |
58 | 40 |
|
59 | | - if vim.version.lt(vim.version(), "0.10-dev") then |
60 | | - vim.health.error(string.format("Nvim out of date, current: %s, minimum: 0.10-dev", versionstring)) |
61 | | - end |
| 41 | + if vim.version.lt(vim.version(), "0.10-dev") then |
| 42 | + vim.health.error(string.format("Nvim out of date, current: %s, minimum: 0.10-dev", versionstring)) |
| 43 | + end |
62 | 44 | end |
63 | 45 |
|
64 | 46 | local checkrequire = function() |
65 | | - for _, deps in ipairs(dependencies) do |
66 | | - attempt_cmd(deps) |
67 | | - end |
| 47 | + for _, deps in ipairs(dependencies) do |
| 48 | + attempt_cmd(deps) |
| 49 | + end |
68 | 50 | end |
69 | 51 |
|
70 | 52 | return { |
71 | | - check = function () |
72 | | - -- vim.health.warn(vim.bo.fileformat:upper()) |
73 | | - -- vim.health.warn(vim.uv.os_environ().DESKTOP_SESSION) |
74 | | - vim.health.start ("Nvim installation package") |
| 53 | + check = function() |
| 54 | + -- vim.health.warn(vim.bo.fileformat:upper()) |
| 55 | + -- vim.health.warn(vim.uv.os_environ().DESKTOP_SESSION) |
| 56 | + vim.health.start("Nvim installation package") |
75 | 57 |
|
76 | | - vim.health.info("[Not all warns is a must fix from checkhealth]" .. '\n' .. |
77 | | - "plugins will complain if packages are missing") |
| 58 | + vim.health.info( |
| 59 | + "[Not all warns is a must fix from checkhealth]" .. "\n" .. "plugins will complain if packages are missing" |
| 60 | + ) |
78 | 61 |
|
79 | | - vim.health.info(string.format("System info: ".. vim.inspect(vim.uv.os_environ().DESKTOP_SESSION))) |
| 62 | + vim.health.info(string.format("System info: " .. vim.inspect(vim.uv.os_environ().DESKTOP_SESSION))) |
80 | 63 |
|
81 | | - checkversion() |
82 | | - checkrequire() |
83 | | - end, |
| 64 | + checkversion() |
| 65 | + checkrequire() |
| 66 | + end, |
84 | 67 | } |
0 commit comments