aboutsummaryrefslogtreecommitdiff
path: root/lua
diff options
context:
space:
mode:
authorjdhao <jdhao@hotmail.com>2022-08-13 22:37:49 +0800
committerjdhao <jdhao@hotmail.com>2022-08-13 22:37:49 +0800
commitb11c57e36fccb1e4c4fe4a28ff8b0a36f4c14236 (patch)
treeee33de2588f4d5267473ee4918d2d00fc3d8349e /lua
parent84d73660fa551f85c6a5236950c13b51e9756da4 (diff)
Transition from init.vim to init.lua
Diffstat (limited to 'lua')
-rw-r--r--lua/utils.lua19
1 files changed, 19 insertions, 0 deletions
diff --git a/lua/utils.lua b/lua/utils.lua
index a6fd11a..13044da 100644
--- a/lua/utils.lua
+++ b/lua/utils.lua
@@ -25,4 +25,23 @@ function M.may_create_dir()
end
end
+function M.check_version_match()
+ -- check if we have the lastest stable version of nvim
+ local expected_ver = {major = 0, minor = 7, patch = 2}
+ local actual_ver = vim.version()
+
+ local ver_match = true
+ for key, val in pairs(expected_ver) do
+ if val ~= actual_ver[key] then
+ ver_match = false
+ break
+ end
+ end
+
+ local expect_ver_str = string.format("%s.%s.%s", expected_ver.major, expected_ver.minor, expected_ver.patch)
+ local nvim_ver_str = string.format("%s.%s.%s", actual_ver.major, actual_ver.minor, actual_ver.patch)
+
+ return {match=ver_match, expected=expect_ver_str, actual=nvim_ver_str}
+end
+
return M