summaryrefslogtreecommitdiff
path: root/.config/nvim/lua/config/init.lua
diff options
context:
space:
mode:
Diffstat (limited to '.config/nvim/lua/config/init.lua')
-rw-r--r--.config/nvim/lua/config/init.lua36
1 files changed, 36 insertions, 0 deletions
diff --git a/.config/nvim/lua/config/init.lua b/.config/nvim/lua/config/init.lua
new file mode 100644
index 0000000..e6d6389
--- /dev/null
+++ b/.config/nvim/lua/config/init.lua
@@ -0,0 +1,36 @@
+local M = {
+ path = string.format("%s/.config/nvim/config.lua", os.getenv "HOME"),
+}
+
+--- Initialize nvim default configuration
+-- Define nvim global variable
+function M:init()
+ local utils = require "utils"
+
+ require "config.defaults"
+
+ local builtins = require "core.builtins"
+ builtins.config(self)
+
+ local settings = require "config.settings"
+ settings.load_options()
+end
+
+--- Override the configuration with a user provided one
+-- @param config_path The path to the configuration overrides
+function M:load(config_path)
+ config_path = config_path or self.path
+ local ok, err = pcall(vim.cmd, "luafile " .. config_path)
+ if not ok then
+ print("Invalid configuration", config_path)
+ print(err)
+ return
+ end
+
+ self.path = config_path
+
+ local settings = require "config.settings"
+ settings.load_commands()
+end
+
+return M