Skip to content

Commit d893ed0

Browse files
committed
Merge pull request #7 from rootiest/v1.7.0
v1.7.0 - More Polish: Dynamic Resizing/repositioning
2 parents 0b2afd8 + 8d714bb commit d893ed0

File tree

3 files changed

+149
-168
lines changed

3 files changed

+149
-168
lines changed

lua/nvim_updater/health.lua

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,13 @@ local function check()
3535
-- Get neovim version info
3636
local nvim_version = get_nvim_version()
3737
if nvim_version.major > 0 or nvim_version.minor >= 10 then
38-
utils.health_msg("ok", "Neovim version: v" .. nvim_version.simple)
38+
health.ok("Neovim version: v" .. nvim_version.simple)
3939
elseif nvim_version.major == 0 and nvim_version.minor >= 9 then
40-
utils.health_msg("warn", "Neovim version: v" .. nvim_version.simple .. " (Deprecated)")
40+
health.warn("Neovim version: v" .. nvim_version.simple .. " (Deprecated)")
4141
else
42-
utils.health_msg("error", "Neovim version: v" .. nvim_version.simple .. " (Unsupported)")
42+
health.error("Neovim version: v" .. nvim_version.simple .. " (Unsupported)")
4343
end
44+
4445
-- Load user configuration
4546
local user_config = require("nvim_updater").default_config or {}
4647
local source_dir = user_config.source_dir or "~/.local/src/neovim"
@@ -49,42 +50,42 @@ local function check()
4950

5051
-- Directory Existence Check
5152
if fn.isdirectory(source_dir) == 1 then
52-
utils.health_msg("ok", "Source directory exists: " .. source_dir)
53+
health.ok("Source directory exists: " .. source_dir)
5354

5455
-- Check that the plugin reflects the same
5556
if utils.directory_exists(source_dir) then
56-
utils.health_msg("ok", "Source directory matches plugin directory: " .. source_dir)
57+
health.ok("Source directory matches plugin directory: " .. source_dir)
5758
else
58-
utils.health_msg("warn", "Source directory does not match plugin directory: " .. source_dir)
59+
health.warn("Source directory does not match plugin directory: " .. source_dir)
5960
end
6061

6162
-- Write permission check using temp file test if the directory exists
6263
if check_write_permissions(source_dir) then
63-
utils.health_msg("ok", "Write access to source directory checked successfully")
64+
health.ok("Write access to source directory checked successfully")
6465
else
65-
utils.health_msg("warn", "No write access to source directory: " .. source_dir)
66-
utils.health_msg("info", "Hint: Run ':NVRemoveSource' to remove and retry with correct permissions.")
66+
health.warn("No write access to source directory: " .. source_dir)
67+
health.info("Hint: Run ':NVRemoveSource' to remove and retry with correct permissions.")
6768
end
6869
else
69-
utils.health_msg("warn", "Source directory does not exist: " .. source_dir)
70-
utils.health_msg("info", "Hint: Run ':NVCloneSource' to clone the Neovim source directory.")
70+
health.warn("Source directory does not exist: " .. source_dir)
71+
health.info("Hint: Run ':NVCloneSource' to clone the Neovim source directory.")
7172

7273
-- Parent directory write permissions check
7374
local parent_dir = fs.dirname(source_dir)
7475
if check_write_permissions(parent_dir) then
75-
utils.health_msg("ok", "Write access to parent directory (" .. parent_dir .. ") is available.")
76+
health.ok("Write access to parent directory (" .. parent_dir .. ") is available.")
7677
else
77-
utils.health_msg("error", "No write access to parent directory: " .. parent_dir)
78-
utils.health_msg("info", "Hint: Adjust permissions or try a different 'source_dir'.")
78+
health.error("No write access to parent directory: " .. parent_dir)
79+
health.info("Hint: Adjust permissions or try a different 'source_dir'.")
7980
end
8081
end
8182

8283
-- Remote Branch Existence Check
8384
local git_output = fn.systemlist("git ls-remote --heads https://github.com/neovim/neovim " .. branch)
8485
if fn.empty(git_output) == 1 then
85-
utils.health_msg("error", "Branch '" .. branch .. "' does not exist on the Neovim GitHub repo!")
86+
health.error("Branch '" .. branch .. "' does not exist on the Neovim GitHub repo!")
8687
else
87-
utils.health_msg("ok", "Remote branch exists: " .. branch)
88+
health.ok("Remote branch exists: " .. branch)
8889
end
8990
end
9091

lua/nvim_updater/init.lua

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -498,27 +498,6 @@ function P.show_new_commits_in_telescope()
498498
})
499499
end
500500

501-
--- Initialize Neovim updater plugin configuration
502-
---@function P.setup
503-
---@param user_config table|nil User configuration overriding default values
504-
function P.setup(user_config)
505-
P.default_config = vim.tbl_deep_extend("force", P.default_config, user_config or {})
506-
507-
-- Setup default keymaps only if not overridden by user configuration
508-
setup_default_keymaps()
509-
510-
-- Setup Neovim user commands
511-
P.setup_usercmds()
512-
513-
-- Check for updates
514-
if P.default_config.check_for_updates then
515-
utils.get_commit_count()
516-
if P.default_config.update_interval > 0 then
517-
utils.update_timer(P.default_config.update_interval)
518-
end
519-
end
520-
end
521-
522501
--- Create user commands for both updating and removing Neovim source directories
523502
---@function P.setup_usercmd
524503
function P.setup_usercmds()
@@ -580,4 +559,25 @@ end, {
580559
desc = "Pick new commits in telescope",
581560
})
582561

562+
--- Initialize Neovim updater plugin configuration
563+
---@function P.setup
564+
---@param user_config table|nil User configuration overriding default values
565+
function P.setup(user_config)
566+
P.default_config = vim.tbl_deep_extend("force", P.default_config, user_config or {})
567+
568+
-- Setup default keymaps only if not overridden by user configuration
569+
setup_default_keymaps()
570+
571+
-- Setup Neovim user commands
572+
P.setup_usercmds()
573+
574+
-- Check for updates
575+
if P.default_config.check_for_updates then
576+
utils.get_commit_count()
577+
if P.default_config.update_interval > 0 then
578+
utils.update_timer(P.default_config.update_interval)
579+
end
580+
end
581+
end
582+
583583
return P

0 commit comments

Comments
 (0)