summaryrefslogtreecommitdiff
path: root/lua/talha
diff options
context:
space:
mode:
Diffstat (limited to 'lua/talha')
-rw-r--r--lua/talha/functions.lua14
-rw-r--r--lua/talha/init.lua2
-rw-r--r--lua/talha/set.lua2
3 files changed, 16 insertions, 2 deletions
diff --git a/lua/talha/functions.lua b/lua/talha/functions.lua
index 2a4570e..b0e8020 100644
--- a/lua/talha/functions.lua
+++ b/lua/talha/functions.lua
@@ -72,3 +72,17 @@ function SetFocusColors(mode)
vim.opt.cursorline = false
vim.cmd("colorscheme vscode")
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
diff --git a/lua/talha/init.lua b/lua/talha/init.lua
index 5dabc12..29b4120 100644
--- a/lua/talha/init.lua
+++ b/lua/talha/init.lua
@@ -1,5 +1,5 @@
require("talha.remap")
-require("talha.set")
require("talha.functions")
+require("talha.set")
require("talha.autocmds")
diff --git a/lua/talha/set.lua b/lua/talha/set.lua
index 814a837..d4b995e 100644
--- a/lua/talha/set.lua
+++ b/lua/talha/set.lua
@@ -13,7 +13,7 @@ op.wrap = false
op.swapfile = false
op.backup = false
-op.undodir = os.getenv("HOME") .. "/.vim/undodir"
+op.undodir = GetHomeDir() .. "/.vim/undodir"
op.undofile = true
op.hlsearch = false