diff options
| author | JP Appel <jeanpierre.appel01@gmail.com> | 2024-02-06 13:07:48 -0500 |
|---|---|---|
| committer | JP Appel <jeanpierre.appel01@gmail.com> | 2024-02-06 13:07:48 -0500 |
| commit | 2d29f9d82fd0ed23a153926ce3da43cdf990a30c (patch) | |
| tree | 8bbcb3c7a8e59e2ba8c3ac4b80a0f661f68a0889 /nvim | |
| parent | 4dbef437d707f82ca5ceffa24ea6198e966888d6 (diff) | |
fix: add module for hostname based configs
Diffstat (limited to 'nvim')
| -rw-r--r-- | nvim/lua/profiles.lua | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/nvim/lua/profiles.lua b/nvim/lua/profiles.lua new file mode 100644 index 0000000..f797a3a --- /dev/null +++ b/nvim/lua/profiles.lua @@ -0,0 +1,28 @@ +-- Tools for conditionally loading plugins via lazy +M = {} + +M.machines = { 'nest', 'Goose.local' } + +local getDefaultmetatable = { + __index = function(tbl, key) + if rawget(tbl, key) then + return tbl[key] + else + return tbl["default"] + end + end +} + +-- Create a table for each machine with a default value +-- current machines: nest, Goose.local +M.createProfiles = function(default) + local profiles = {} + profiles.default = default + for _, machine in ipairs(M.machines) do + profiles[machine] = default + end + setmetatable(profiles, getDefaultmetatable) + return profiles +end + +return M |
