mirror of
https://github.com/nix-community/nixvim.git
synced 2025-07-12 18:24:35 +02:00
modules/options: add localOptions and globalOptions
This commit is contained in:
parent
b140981d65
commit
02149dbb01
2 changed files with 66 additions and 0 deletions
|
@ -12,6 +12,18 @@ with lib; {
|
|||
description = "The configuration options, e.g. line numbers";
|
||||
};
|
||||
|
||||
globalOptions = mkOption {
|
||||
type = types.attrsOf types.anything;
|
||||
default = {};
|
||||
description = "The configuration global options";
|
||||
};
|
||||
|
||||
localOptions = mkOption {
|
||||
type = types.attrsOf types.anything;
|
||||
default = {};
|
||||
description = "The configuration local options";
|
||||
};
|
||||
|
||||
globals = mkOption {
|
||||
type = types.attrsOf types.anything;
|
||||
default = {};
|
||||
|
@ -42,6 +54,28 @@ with lib; {
|
|||
end
|
||||
end
|
||||
-- }}}
|
||||
''
|
||||
+ optionalString (config.localOptions != {}) ''
|
||||
-- Set up local options {{{
|
||||
do
|
||||
local nixvim_local_options = ${helpers.toLuaObject config.localOptions}
|
||||
|
||||
for k,v in pairs(nixvim_local_options) do
|
||||
vim.opt_local[k] = v
|
||||
end
|
||||
end
|
||||
-- }}}
|
||||
''
|
||||
+ optionalString (config.globalOptions != {}) ''
|
||||
-- Set up global options {{{
|
||||
do
|
||||
local nixvim_global_options = ${helpers.toLuaObject config.globalOptions}
|
||||
|
||||
for k,v in pairs(nixvim_global_options) do
|
||||
vim.opt_global[k] = v
|
||||
end
|
||||
end
|
||||
-- }}}
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue