From 864f7780998512f066d3146cba99705cca457fda Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Sat, 24 Mar 2018 08:03:28 -0500 Subject: [PATCH] load user clink --- .gitignore | 1 + vendor/clink.lua | 22 ++++++++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/.gitignore b/.gitignore index cf231c5..eb66319 100644 --- a/.gitignore +++ b/.gitignore @@ -14,6 +14,7 @@ build/ Version v* *.bak config/user-* +config/*.lua config/settings config/aliases config/profile.d diff --git a/vendor/clink.lua b/vendor/clink.lua index 12d0616..e692951 100644 --- a/vendor/clink.lua +++ b/vendor/clink.lua @@ -351,3 +351,25 @@ for _,lua_module in ipairs(clink.find_files(completions_dir..'*.lua')) do dofile(filename) end end + +local cmder_config_dir = clink.get_env('CMDER_ROOT')..'/config/' +for _,lua_module in ipairs(clink.find_files(cmder_config_dir..'*.lua')) do + -- Skip files that starts with _. This could be useful if some files should be ignored + if not string.match(lua_module, '^_.*') then + local filename = cmder_config_dir..lua_module + -- use dofile instead of require because require caches loaded modules + -- so config reloading using Alt-Q won't reload updated modules. + dofile(filename) + end +end + +local cmder_user_config_dir = clink.get_env('CMDER_USER_CONFIG')..'/' +for _,lua_module in ipairs(clink.find_files(cmder_user_config_dir..'*.lua')) do + -- Skip files that starts with _. This could be useful if some files should be ignored + if not string.match(lua_module, '^_.*') then + local filename = cmder_user_config_dir..lua_module + -- use dofile instead of require because require caches loaded modules + -- so config reloading using Alt-Q won't reload updated modules. + dofile(filename) + end +end