From 7e1c16b7aefbb253e391dc5b8361621142772e3d Mon Sep 17 00:00:00 2001 From: talha Date: Wed, 3 Jan 2024 00:46:20 +0500 Subject: Fixed some path issues with windows --- lua/talha/functions.lua | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'lua/talha/functions.lua') diff --git a/lua/talha/functions.lua b/lua/talha/functions.lua index 946bfd8..e17cada 100644 --- a/lua/talha/functions.lua +++ b/lua/talha/functions.lua @@ -60,3 +60,18 @@ function ToggleSpellCheck() vim.opt.spell = not(vim.opt.spell:get()) vim.opt.spelllang = 'en_us' end + +function GetHomeDir() + -- for linux/mac + local home = os.getenv("HOME") + -- for windows + local user_profile = os.getenv("UserProfile") + + if home ~= nil then + return home + elseif user_profile ~= nil then + return user_profile + end + + return nil +end -- cgit v1.2.3