-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinit.lua
47 lines (38 loc) · 1.67 KB
/
init.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
---[[---------------------------------------]]---
-- system - Doom Nvim system integration --
-- Author: NTBBloodbath --
-- License: GPLv2 --
---[[---------------------------------------]]---
local M = {}
-- get_config_dir will get the config path based in the current system, e.g.
-- 'C:\Users\JohnDoe\AppData\Local' for windows and '~/.config' for *nix
-- @return string
local function get_config_dir()
if string.find(vim.loop.os_uname().sysname, "Windows") then
return os.getenv("USERPROFILE") .. "\\AppData\\Local\\"
end
return (os.getenv("XDG_CONFIG_HOME") and os.getenv("XDG_CONFIG_HOME"))
or (os.getenv("HOME") .. "/.config")
end
-- get_separator will return the system paths separator, e.g. \ for Windows and / for *nix
-- @return string
local function get_separator()
if vim.loop.os_uname().sysname == "Windows" then
return "\\"
end
return "/"
end
M.config_dir = get_config_dir()
M.sep = get_separator()
-- The doom-nvim root directory, works as a fallback for looking Doom Nvim configurations
-- in case that doom_configs_root directory does not exists.
M.doom_root = string.format("%s%snvim", M.config_dir, M.sep)
-- The doom-nvim configurations root directory
M.doom_configs_root = string.format("%s%sdoom-nvim", M.config_dir, M.sep)
-- The doom-nvim logs file path
M.doom_logs = vim.fn.stdpath("data") .. string.format("%sdoom.log", M.sep)
-- The doom-nvim bug report file path
M.doom_report = vim.fn.stdpath("data") .. string.format("%sdoom_report.md", M.sep)
-- The git workspace for doom-nvim, e.g. 'git -C /home/JohnDoe/.config/nvim'
M.git_workspace = string.format("git -C %s ", M.doom_root)
return M