treewide (cleaning): helpers.toLuaObject -> lib.nixvim.toLuaObject

This commit is contained in:
Gaetan Lepage 2024-12-15 20:32:14 +01:00 committed by nix-infra-bot
parent 78e295fa41
commit ec24d496d5
65 changed files with 104 additions and 104 deletions

View file

@ -58,7 +58,7 @@
(lib.optionalString (autoGroups != { }) '' (lib.optionalString (autoGroups != { }) ''
-- Set up autogroups {{ -- Set up autogroups {{
do do
local __nixvim_autogroups = ${helpers.toLuaObject autoGroups} local __nixvim_autogroups = ${lib.nixvim.toLuaObject autoGroups}
for group_name, options in pairs(__nixvim_autogroups) do for group_name, options in pairs(__nixvim_autogroups) do
vim.api.nvim_create_augroup(group_name, options) vim.api.nvim_create_augroup(group_name, options)
@ -69,7 +69,7 @@
+ (lib.optionalString (autoCmd != [ ]) '' + (lib.optionalString (autoCmd != [ ]) ''
-- Set up autocommands {{ -- Set up autocommands {{
do do
local __nixvim_autocommands = ${helpers.toLuaObject autoCmd} local __nixvim_autocommands = ${lib.nixvim.toLuaObject autoCmd}
for _, autocmd in ipairs(__nixvim_autocommands) do for _, autocmd in ipairs(__nixvim_autocommands) do
vim.api.nvim_create_autocmd( vim.api.nvim_create_autocmd(

View file

@ -73,7 +73,7 @@ in
in in
lib.mkIf (config.userCommands != { }) { lib.mkIf (config.userCommands != { }) {
extraConfigLua = helpers.wrapDo '' extraConfigLua = helpers.wrapDo ''
local cmds = ${helpers.toLuaObject (lib.mapAttrs cleanupCommand config.userCommands)}; local cmds = ${lib.nixvim.toLuaObject (lib.mapAttrs cleanupCommand config.userCommands)};
for name,cmd in pairs(cmds) do for name,cmd in pairs(cmds) do
vim.api.nvim_create_user_command(name, cmd.command, cmd.options or {}) vim.api.nvim_create_user_command(name, cmd.command, cmd.options or {})
end end

View file

@ -19,7 +19,7 @@
config = { config = {
extraConfigLuaPre = lib.mkIf (config.diagnostics != { }) '' extraConfigLuaPre = lib.mkIf (config.diagnostics != { }) ''
vim.diagnostic.config(${helpers.toLuaObject config.diagnostics}) vim.diagnostic.config(${lib.nixvim.toLuaObject config.diagnostics})
''; '';
}; };
} }

View file

@ -58,6 +58,6 @@ in
config.extraConfigLua = config.extraConfigLua =
lib.mkIf (cfg != null && (builtins.any (v: v != null) (builtins.attrValues cfg))) lib.mkIf (cfg != null && (builtins.any (v: v != null) (builtins.attrValues cfg)))
'' ''
vim.filetype.add(${helpers.toLuaObject cfg}) vim.filetype.add(${lib.nixvim.toLuaObject cfg})
''; '';
} }

View file

@ -42,7 +42,7 @@
'' ''
-- Highlight groups {{ -- Highlight groups {{
do do
local highlights = ${helpers.toLuaObject config.highlight} local highlights = ${lib.nixvim.toLuaObject config.highlight}
for k,v in pairs(highlights) do for k,v in pairs(highlights) do
vim.api.nvim_set_hl(0, k, v) vim.api.nvim_set_hl(0, k, v)
@ -56,7 +56,7 @@
'' ''
-- Highlight groups {{ -- Highlight groups {{
do do
local highlights = ${helpers.toLuaObject config.highlightOverride} local highlights = ${lib.nixvim.toLuaObject config.highlightOverride}
for k,v in pairs(highlights) do for k,v in pairs(highlights) do
vim.api.nvim_set_hl(0, k, v) vim.api.nvim_set_hl(0, k, v)
@ -72,7 +72,7 @@
'' ''
-- Match groups {{ -- Match groups {{
do do
local match = ${helpers.toLuaObject config.match} local match = ${lib.nixvim.toLuaObject config.match}
for k,v in pairs(match) do for k,v in pairs(match) do
vim.fn.matchadd(k, v) vim.fn.matchadd(k, v)

View file

@ -81,7 +81,7 @@
extraConfigLua = lib.mkIf (config.keymaps != [ ]) '' extraConfigLua = lib.mkIf (config.keymaps != [ ]) ''
-- Set up keybinds {{{ -- Set up keybinds {{{
do do
local __nixvim_binds = ${helpers.toLuaObject (map helpers.keymaps.removeDeprecatedMapAttrs config.keymaps)} local __nixvim_binds = ${lib.nixvim.toLuaObject (map helpers.keymaps.removeDeprecatedMapAttrs config.keymaps)}
for i, map in ipairs(__nixvim_binds) do for i, map in ipairs(__nixvim_binds) do
vim.keymap.set(map.mode, map.key, map.action, map.options) vim.keymap.set(map.mode, map.key, map.action, map.options)
end end
@ -99,7 +99,7 @@
callback = helpers.mkRaw '' callback = helpers.mkRaw ''
function() function()
do do
local __nixvim_binds = ${helpers.toLuaObject (map helpers.keymaps.removeDeprecatedMapAttrs mappings)} local __nixvim_binds = ${lib.nixvim.toLuaObject (map helpers.keymaps.removeDeprecatedMapAttrs mappings)}
for i, map in ipairs(__nixvim_binds) do for i, map in ipairs(__nixvim_binds) do
vim.keymap.set(map.mode, map.key, map.action, map.options) vim.keymap.set(map.mode, map.key, map.action, map.options)
end end

View file

@ -67,7 +67,7 @@ in
}: }:
let let
varName = "nixvim_${luaVariableName}"; varName = "nixvim_${luaVariableName}";
optionDefinitions = helpers.toLuaObject config.${optionName}; optionDefinitions = lib.nixvim.toLuaObject config.${optionName};
in in
lib.optionalString (optionDefinitions != "{ }") '' lib.optionalString (optionDefinitions != "{ }") ''
-- Set up ${prettyName} {{{ -- Set up ${prettyName} {{{

View file

@ -86,7 +86,7 @@ in
}; };
in in
'' ''
require('autoclose').setup(${helpers.toLuaObject setupOptions}) require('autoclose').setup(${lib.nixvim.toLuaObject setupOptions})
''; '';
}; };
} }

View file

@ -516,7 +516,7 @@ in
extraPlugins = [ cfg.package ]; extraPlugins = [ cfg.package ];
extraConfigLua = '' extraConfigLua = ''
vim.api.nvim_set_var("chadtree_settings", ${helpers.toLuaObject setupOptions}) vim.api.nvim_set_var("chadtree_settings", ${lib.nixvim.toLuaObject setupOptions})
''; '';
}; };
} }

View file

@ -265,7 +265,7 @@ in
extraPlugins = [ cfg.package ]; extraPlugins = [ cfg.package ];
plugins.lsp.postConfig = '' plugins.lsp.postConfig = ''
require("clangd_extensions").setup(${helpers.toLuaObject setupOptions}) require("clangd_extensions").setup(${lib.nixvim.toLuaObject setupOptions})
''; '';
}; };
} }

View file

@ -153,7 +153,7 @@ in
// cfg.extraOptions; // cfg.extraOptions;
in in
'' ''
require('clipboard-image').setup(${helpers.toLuaObject setupOptions}) require('clipboard-image').setup(${lib.nixvim.toLuaObject setupOptions})
''; '';
}; };
} }

View file

@ -214,7 +214,7 @@ in
// cfg.extraOptions; // cfg.extraOptions;
in in
'' ''
require('copilot').setup(${helpers.toLuaObject setupOptions}) require('copilot').setup(${lib.nixvim.toLuaObject setupOptions})
''; '';
}; };
} }

View file

@ -66,7 +66,7 @@ in
extraPlugins = [ cfg.package ]; extraPlugins = [ cfg.package ];
extraConfigLua = '' extraConfigLua = ''
require('coq_3p')(${helpers.toLuaObject cfg.sources}) require('coq_3p')(${lib.nixvim.toLuaObject cfg.sources})
''; '';
}; };
} }

View file

@ -267,7 +267,7 @@ in
extraPlugins = [ cfg.package ]; extraPlugins = [ cfg.package ];
extraConfigLua = '' extraConfigLua = ''
require("coverage").setup(${helpers.toLuaObject setupOptions}) require("coverage").setup(${lib.nixvim.toLuaObject setupOptions})
''; '';
keymaps = flatten ( keymaps = flatten (

View file

@ -55,7 +55,7 @@ in
extraPlugins = [ cfg.package ]; extraPlugins = [ cfg.package ];
extraConfigLua = '' extraConfigLua = ''
require('nvim-cursorline').setup(${helpers.toLuaObject options}) require('nvim-cursorline').setup(${lib.nixvim.toLuaObject options})
''; '';
}; };
} }

View file

@ -61,7 +61,7 @@ in
plugins.dap = { plugins.dap = {
enable = true; enable = true;
extensionConfigLua = '' extensionConfigLua = ''
require("dap-go").setup(${helpers.toLuaObject options}) require("dap-go").setup(${lib.nixvim.toLuaObject options})
''; '';
}; };
}; };

View file

@ -239,7 +239,7 @@ in
enable = true; enable = true;
extensionConfigLua = '' extensionConfigLua = ''
require("dapui").setup(${helpers.toLuaObject options}); require("dapui").setup(${lib.nixvim.toLuaObject options});
''; '';
}; };
}; };

View file

@ -94,7 +94,7 @@ in
enable = true; enable = true;
extensionConfigLua = '' extensionConfigLua = ''
require("nvim-dap-virtual-text").setup(${helpers.toLuaObject options}); require("nvim-dap-virtual-text").setup(${lib.nixvim.toLuaObject options});
''; '';
}; };
}; };

View file

@ -90,13 +90,13 @@ with dapHelpers;
extraConfigLua = extraConfigLua =
(optionalString (cfg.adapters != null) '' (optionalString (cfg.adapters != null) ''
require("dap").adapters = ${helpers.toLuaObject options.adapters} require("dap").adapters = ${lib.nixvim.toLuaObject options.adapters}
'') '')
+ (optionalString (options.configurations != null) '' + (optionalString (options.configurations != null) ''
require("dap").configurations = ${helpers.toLuaObject options.configurations} require("dap").configurations = ${lib.nixvim.toLuaObject options.configurations}
'') '')
+ (optionalString (cfg.signs != null) '' + (optionalString (cfg.signs != null) ''
local __dap_signs = ${helpers.toLuaObject options.signs} local __dap_signs = ${lib.nixvim.toLuaObject options.signs}
for sign_name, sign in pairs(__dap_signs) do for sign_name, sign in pairs(__dap_signs) do
vim.fn.sign_define(sign_name, sign) vim.fn.sign_define(sign_name, sign)
end end

View file

@ -835,7 +835,7 @@ in
extraPlugins = [ cfg.package ]; extraPlugins = [ cfg.package ];
extraConfigLua = '' extraConfigLua = ''
require("diffview").setup(${helpers.toLuaObject setupOptions}) require("diffview").setup(${lib.nixvim.toLuaObject setupOptions})
''; '';
}; };
} }

View file

@ -677,7 +677,7 @@ in
// cfg.extraOptions; // cfg.extraOptions;
in in
'' ''
require("fidget").setup${helpers.toLuaObject setupOptions} require("fidget").setup${lib.nixvim.toLuaObject setupOptions}
''; '';
}; };
} }

View file

@ -135,7 +135,7 @@ lib.nixvim.neovim-plugin.mkNeovimPlugin {
if isString mapping then if isString mapping then
"${mapping}()" "${mapping}()"
else else
"${mapping.action}(${helpers.toLuaObject mapping.settings})"; "${mapping.action}(${lib.nixvim.toLuaObject mapping.settings})";
in in
{ {
inherit key; inherit key;

View file

@ -85,7 +85,7 @@ in
telescopeCfg = ''require("telescope").load_extension("git_worktree")''; telescopeCfg = ''require("telescope").load_extension("git_worktree")'';
in in
'' ''
require('git-worktree').setup(${helpers.toLuaObject setupOptions}) require('git-worktree').setup(${lib.nixvim.toLuaObject setupOptions})
${if cfg.enableTelescope then telescopeCfg else ""} ${if cfg.enableTelescope then telescopeCfg else ""}
''; '';
}; };

View file

@ -103,7 +103,7 @@ with lib;
// cfg.extraOptions; // cfg.extraOptions;
in in
'' ''
require('gitlinker').setup(${helpers.toLuaObject setupOptions}) require('gitlinker').setup(${lib.nixvim.toLuaObject setupOptions})
''; '';
}; };
} }

View file

@ -205,7 +205,7 @@ in
telescopeCfg = ''require("telescope").load_extension("harpoon")''; telescopeCfg = ''require("telescope").load_extension("harpoon")'';
in in
'' ''
require('harpoon').setup(${helpers.toLuaObject setupOptions}) require('harpoon').setup(${lib.nixvim.toLuaObject setupOptions})
${if cfg.enableTelescope then telescopeCfg else ""} ${if cfg.enableTelescope then telescopeCfg else ""}
''; '';

View file

@ -39,9 +39,9 @@ lib.nixvim.neovim-plugin.mkNeovimPlugin {
plugins.hydra.luaConfig.content = '' plugins.hydra.luaConfig.content = ''
hydra = require('hydra') hydra = require('hydra')
hydra.setup(${helpers.toLuaObject cfg.settings}) hydra.setup(${lib.nixvim.toLuaObject cfg.settings})
__hydra_defs = ${helpers.toLuaObject cfg.hydras} __hydra_defs = ${lib.nixvim.toLuaObject cfg.hydras}
for _, hydra_config in ipairs(__hydra_defs) do for _, hydra_config in ipairs(__hydra_defs) do
hydra(hydra_config) hydra(hydra_config)
end end

View file

@ -150,7 +150,7 @@ in
extraPlugins = [ cfg.package ]; extraPlugins = [ cfg.package ];
extraConfigLua = '' extraConfigLua = ''
require("illuminate").configure(${helpers.toLuaObject setupOptions}) require("illuminate").configure(${lib.nixvim.toLuaObject setupOptions})
''; '';
}; };
} }

View file

@ -166,7 +166,7 @@ in
// cfg.extraOptions; // cfg.extraOptions;
in in
'' ''
require('image').setup(${helpers.toLuaObject setupOptions}) require('image').setup(${lib.nixvim.toLuaObject setupOptions})
''; '';
}; };
} }

View file

@ -55,7 +55,7 @@ with lib;
extraPlugins = [ cfg.package ]; extraPlugins = [ cfg.package ];
extraConfigLua = '' extraConfigLua = ''
require("inc_rename").setup(${helpers.toLuaObject setupOptions}) require("inc_rename").setup(${lib.nixvim.toLuaObject setupOptions})
''; '';
}; };
} }

View file

@ -48,7 +48,7 @@ with lib;
extraPlugins = [ cfg.package ]; extraPlugins = [ cfg.package ];
extraConfigLua = '' extraConfigLua = ''
require('nvim-lastplace').setup(${helpers.toLuaObject options}) require('nvim-lastplace').setup(${lib.nixvim.toLuaObject options})
''; '';
}; };
} }

View file

@ -301,7 +301,7 @@ in
// cfg.extraOptions; // cfg.extraOptions;
in in
'' ''
require("lean").setup(${helpers.toLuaObject setupOptions}) require("lean").setup(${lib.nixvim.toLuaObject setupOptions})
''; '';
}; };
} }

View file

@ -183,7 +183,7 @@ in
+ (optionalString (options != { }) '' + (optionalString (options != { }) ''
require('leap').opts = vim.tbl_deep_extend( require('leap').opts = vim.tbl_deep_extend(
"keep", "keep",
${helpers.toLuaObject options}, ${lib.nixvim.toLuaObject options},
require('leap').opts require('leap').opts
) )
''); '');

View file

@ -233,7 +233,7 @@ in
extraConfigLua = extraConfigLua =
'' ''
__lint = require('lint') __lint = require('lint')
__lint.linters_by_ft = ${helpers.toLuaObject cfg.lintersByFt} __lint.linters_by_ft = ${lib.nixvim.toLuaObject cfg.lintersByFt}
'' ''
+ (optionalString (cfg.linters != { }) ( + (optionalString (cfg.linters != { }) (
concatLines ( concatLines (
@ -244,7 +244,7 @@ in
propName: propValue: propName: propValue:
optionalString ( optionalString (
propValue != null propValue != null
) ''__lint.linters["${linter}"]["${propName}"] = ${helpers.toLuaObject propValue}'' ) ''__lint.linters["${linter}"]["${propName}"] = ${lib.nixvim.toLuaObject propValue}''
) linterConfig ) linterConfig
) cfg.linters ) cfg.linters
) )
@ -257,7 +257,7 @@ in
let let
linterConfig' = if isString linterConfig then helpers.mkRaw linterConfig else linterConfig; linterConfig' = if isString linterConfig then helpers.mkRaw linterConfig else linterConfig;
in in
''__lint.linters["${customLinter}"] = ${helpers.toLuaObject linterConfig'}'' ''__lint.linters["${customLinter}"] = ${lib.nixvim.toLuaObject linterConfig'}''
) cfg.customLinters ) cfg.customLinters
) )
)); ));

View file

@ -75,21 +75,21 @@ in
extraPlugins = [ cfg.package ]; extraPlugins = [ cfg.package ];
extraConfigLua = optionalString (!doCmp) '' extraConfigLua = optionalString (!doCmp) ''
require('lspkind').init(${helpers.toLuaObject options}) require('lspkind').init(${lib.nixvim.toLuaObject options})
''; '';
plugins.cmp.settings.formatting.format = plugins.cmp.settings.formatting.format =
if cfg.cmp.after != null then if cfg.cmp.after != null then
'' ''
function(entry, vim_item) function(entry, vim_item)
local kind = require('lspkind').cmp_format(${helpers.toLuaObject options})(entry, vim_item) local kind = require('lspkind').cmp_format(${lib.nixvim.toLuaObject options})(entry, vim_item)
return (${cfg.cmp.after})(entry, vim_item, kind) return (${cfg.cmp.after})(entry, vim_item, kind)
end end
'' ''
else else
'' ''
require('lspkind').cmp_format(${helpers.toLuaObject options}) require('lspkind').cmp_format(${lib.nixvim.toLuaObject options})
''; '';
}; };
} }

View file

@ -636,7 +636,7 @@ in
// cfg.extraOptions; // cfg.extraOptions;
in in
'' ''
require('lspsaga').setup(${helpers.toLuaObject setupOptions}) require('lspsaga').setup(${lib.nixvim.toLuaObject setupOptions})
''; '';
}; };
} }

View file

@ -55,7 +55,7 @@ lib.nixvim.neovim-plugin.mkNeovimPlugin {
enable = true; enable = true;
onAttach.function = '' onAttach.function = ''
require("ltex_extra").setup(${helpers.toLuaObject cfg.settings}) require("ltex_extra").setup(${lib.nixvim.toLuaObject cfg.settings})
''; '';
}; };
}; };

View file

@ -186,18 +186,18 @@ in
] loader; ] loader;
in in
'' ''
require("luasnip.loaders.from_${name}").${optionalString loader.lazyLoad "lazy_"}load(${helpers.toLuaObject options}) require("luasnip.loaders.from_${name}").${optionalString loader.lazyLoad "lazy_"}load(${lib.nixvim.toLuaObject options})
'' ''
)) ))
]; ];
filetypeExtendConfig = mapAttrsToList (n: v: '' filetypeExtendConfig = mapAttrsToList (n: v: ''
require("luasnip").filetype_extend("${n}", ${helpers.toLuaObject v}) require("luasnip").filetype_extend("${n}", ${lib.nixvim.toLuaObject v})
'') cfg.filetypeExtend; '') cfg.filetypeExtend;
extraConfig = [ extraConfig = [
'' ''
require("luasnip").config.setup(${helpers.toLuaObject cfg.settings}) require("luasnip").config.setup(${lib.nixvim.toLuaObject cfg.settings})
'' ''
]; ];
in in

View file

@ -42,7 +42,7 @@ in
extraPlugins = [ cfg.package ]; extraPlugins = [ cfg.package ];
extraConfigLua = '' extraConfigLua = ''
require("mark-radar").setup(${helpers.toLuaObject setupOptions}) require("mark-radar").setup(${lib.nixvim.toLuaObject setupOptions})
''; '';
}; };
} }

View file

@ -184,7 +184,7 @@ in
// cfg.extraOptions; // cfg.extraOptions;
in in
'' ''
require('marks').setup(${helpers.toLuaObject setupOptions}) require('marks').setup(${lib.nixvim.toLuaObject setupOptions})
''; '';
}; };
} }

View file

@ -645,7 +645,7 @@ in
extraPlugins = [ cfg.package ]; extraPlugins = [ cfg.package ];
extraConfigLua = '' extraConfigLua = ''
require("mkdnflow").setup(${helpers.toLuaObject setupOptions}) require("mkdnflow").setup(${lib.nixvim.toLuaObject setupOptions})
''; '';
}; };
} }

View file

@ -243,7 +243,7 @@ in
extraPlugins = [ cfg.package ]; extraPlugins = [ cfg.package ];
extraConfigLua = '' extraConfigLua = ''
require("multicursors").setup(${helpers.toLuaObject setupOptions}) require("multicursors").setup(${lib.nixvim.toLuaObject setupOptions})
''; '';
}; };
} }

View file

@ -267,7 +267,7 @@ in
extraConfigLua = '' extraConfigLua = ''
local actions = require("nvim-navbuddy.actions") local actions = require("nvim-navbuddy.actions")
require('nvim-navbuddy').setup(${helpers.toLuaObject setupOptions}) require('nvim-navbuddy').setup(${lib.nixvim.toLuaObject setupOptions})
''; '';
}; };
} }

View file

@ -1136,7 +1136,7 @@ in
]; ];
extraConfigLua = '' extraConfigLua = ''
require('neo-tree').setup(${helpers.toLuaObject setupOptions}) require('neo-tree').setup(${lib.nixvim.toLuaObject setupOptions})
''; '';
extraPackages = [ cfg.gitPackage ]; extraPackages = [ cfg.gitPackage ];

View file

@ -202,7 +202,7 @@ in
extraPlugins = [ cfg.package ]; extraPlugins = [ cfg.package ];
extraConfigLua = '' extraConfigLua = ''
require("neogen").setup(${helpers.toLuaObject setupOptions}) require("neogen").setup(${lib.nixvim.toLuaObject setupOptions})
''; '';
keymaps = flatten ( keymaps = flatten (

View file

@ -47,12 +47,12 @@ in
config = mkIf cfg.enable { config = mkIf cfg.enable {
extraPlugins = [ cfg.package ]; extraPlugins = [ cfg.package ];
extraConfigLua = '' extraConfigLua = ''
local __ignored_variables = ${helpers.toLuaObject cfg.ignoredVariables} local __ignored_variables = ${lib.nixvim.toLuaObject cfg.ignoredVariables}
for ignoredVariable, shouldIgnore in ipairs(__ignored_variables) do for ignoredVariable, shouldIgnore in ipairs(__ignored_variables) do
require("nix-develop").ignored_variables[ignoredVariable] = shouldIgnore require("nix-develop").ignored_variables[ignoredVariable] = shouldIgnore
end end
local __separated_variables = ${helpers.toLuaObject cfg.separatedVariables} local __separated_variables = ${lib.nixvim.toLuaObject cfg.separatedVariables}
for variable, separator in ipairs(__separated_variables) do for variable, separator in ipairs(__separated_variables) do
require("nix-develop").separated_variables[variable] = separator require("nix-develop").separated_variables[variable] = separator
end end

View file

@ -125,7 +125,7 @@ in
extraConfigLua = '' extraConfigLua = ''
vim.notify = require('notify'); vim.notify = require('notify');
require('notify').setup(${helpers.toLuaObject setupOptions}) require('notify').setup(${lib.nixvim.toLuaObject setupOptions})
''; '';
}; };
} }

View file

@ -164,7 +164,7 @@ in
extraPlugins = [ cfg.package ]; extraPlugins = [ cfg.package ];
extraConfigLua = '' extraConfigLua = ''
require('bqf').setup(${helpers.toLuaObject options}) require('bqf').setup(${lib.nixvim.toLuaObject options})
''; '';
}; };
} }

View file

@ -143,7 +143,7 @@ in
pattern = "java"; pattern = "java";
callback.__raw = '' callback.__raw = ''
function () function ()
require('jdtls').start_or_attach(${helpers.toLuaObject options}) require('jdtls').start_or_attach(${lib.nixvim.toLuaObject options})
end end
''; '';
} }

View file

@ -117,7 +117,7 @@ with lib;
]; ];
extraConfigLua = '' extraConfigLua = ''
require('osc52').setup(${helpers.toLuaObject setupOptions}) require('osc52').setup(${lib.nixvim.toLuaObject setupOptions})
''; '';
}; };
} }

View file

@ -1113,7 +1113,7 @@ in
-- Will automatically open the tree when running setup if startup buffer is a directory, -- Will automatically open the tree when running setup if startup buffer is a directory,
-- is empty or is unnamed. nvim-tree window will be focused. -- is empty or is unnamed. nvim-tree window will be focused.
local open_on_setup = ${helpers.toLuaObject cfg.openOnSetup} local open_on_setup = ${lib.nixvim.toLuaObject cfg.openOnSetup}
if (directory or no_name) and open_on_setup then if (directory or no_name) and open_on_setup then
-- change to the directory -- change to the directory
@ -1131,7 +1131,7 @@ in
-- Will automatically open the tree when running setup if startup buffer is a file. -- Will automatically open the tree when running setup if startup buffer is a file.
-- File window will be focused. -- File window will be focused.
-- File will be found if updateFocusedFile is enabled. -- File will be found if updateFocusedFile is enabled.
local open_on_setup_file = ${helpers.toLuaObject cfg.openOnSetupFile} local open_on_setup_file = ${lib.nixvim.toLuaObject cfg.openOnSetupFile}
-- buffer is a real file on the disk -- buffer is a real file on the disk
local real_file = vim.fn.filereadable(data.file) == 1 local real_file = vim.fn.filereadable(data.file) == 1
@ -1140,7 +1140,7 @@ in
-- skip ignored filetypes -- skip ignored filetypes
local filetype = vim.bo[data.buf].ft local filetype = vim.bo[data.buf].ft
local ignored_filetypes = ${helpers.toLuaObject cfg.ignoreFtOnSetup} local ignored_filetypes = ${lib.nixvim.toLuaObject cfg.ignoreFtOnSetup}
if not vim.tbl_contains(ignored_filetypes, filetype) then if not vim.tbl_contains(ignored_filetypes, filetype) then
-- open the tree but don't focus it -- open the tree but don't focus it
@ -1152,7 +1152,7 @@ in
------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------
-- Will ignore the buffer, when deciding to open the tree on setup. -- Will ignore the buffer, when deciding to open the tree on setup.
local ignore_buffer_on_setup = ${helpers.toLuaObject cfg.ignoreBufferOnSetup} local ignore_buffer_on_setup = ${lib.nixvim.toLuaObject cfg.ignoreBufferOnSetup}
if ignore_buffer_on_setup then if ignore_buffer_on_setup then
require("nvim-tree.api").tree.open() require("nvim-tree.api").tree.open()
end end
@ -1189,7 +1189,7 @@ in
(optionalString autoOpenEnabled openNvimTreeFunction) (optionalString autoOpenEnabled openNvimTreeFunction)
+ '' + ''
require('nvim-tree').setup(${helpers.toLuaObject setupOptions}) require('nvim-tree').setup(${lib.nixvim.toLuaObject setupOptions})
''; '';
extraPackages = [ cfg.gitPackage ]; extraPackages = [ cfg.gitPackage ];

View file

@ -226,7 +226,7 @@ in
// cfg.extraOptions; // cfg.extraOptions;
in in
'' ''
require('ollama').setup(${helpers.toLuaObject setupOptions}) require('ollama').setup(${lib.nixvim.toLuaObject setupOptions})
''; '';
}; };
} }

View file

@ -73,7 +73,7 @@ with lib;
}; };
in in
'' ''
require('persistence').setup(${helpers.toLuaObject opts}) require('persistence').setup(${lib.nixvim.toLuaObject opts})
''; '';
}; };
} }

View file

@ -212,7 +212,7 @@ in
mkIf cfg.enable { mkIf cfg.enable {
extraPlugins = [ cfg.package ]; extraPlugins = [ cfg.package ];
extraConfigLua = '' extraConfigLua = ''
require("presence").setup${helpers.toLuaObject setupOptions} require("presence").setup${lib.nixvim.toLuaObject setupOptions}
''; '';
}; };
} }

View file

@ -136,7 +136,7 @@ lib.nixvim.vim-plugin.mkVimPlugin {
plugins.lsp.servers = { plugins.lsp.servers = {
jsonls.settings = mkIf cfg.json.enable { jsonls.settings = mkIf cfg.json.enable {
schemas.__raw = '' schemas.__raw = ''
require('schemastore').json.schemas(${helpers.toLuaObject cfg.json.settings}) require('schemastore').json.schemas(${lib.nixvim.toLuaObject cfg.json.settings})
''; '';
# The plugin recommends to enable this option in its README. # The plugin recommends to enable this option in its README.
@ -155,7 +155,7 @@ lib.nixvim.vim-plugin.mkVimPlugin {
}; };
schemas.__raw = '' schemas.__raw = ''
require('schemastore').yaml.schemas(${helpers.toLuaObject cfg.yaml.settings}) require('schemastore').yaml.schemas(${lib.nixvim.toLuaObject cfg.yaml.settings})
''; '';
}; };
}; };

View file

@ -74,7 +74,7 @@ in
keymaps = mappings; keymaps = mappings;
extraConfigLua = '' extraConfigLua = ''
require("${pluginName}").setup(${helpers.toLuaObject setupOptions}) require("${pluginName}").setup(${lib.nixvim.toLuaObject setupOptions})
''; '';
}; };
} }

View file

@ -334,10 +334,10 @@ in
} // sections; } // sections;
in in
'' ''
require('startup').setup(${helpers.toLuaObject setupOptions}) require('startup').setup(${lib.nixvim.toLuaObject setupOptions})
'' ''
+ (optionalString ( + (optionalString (
cfg.userMappings != { } cfg.userMappings != { }
) "require('startup').create_mappings(${helpers.toLuaObject cfg.userMappings})"); ) "require('startup').create_mappings(${lib.nixvim.toLuaObject cfg.userMappings})");
}; };
} }

View file

@ -432,14 +432,14 @@ lib.nixvim.neovim-plugin.mkNeovimPlugin {
# NOTE: Upstream state that the parser MUST be at the beginning of runtimepath. # NOTE: Upstream state that the parser MUST be at the beginning of runtimepath.
# Otherwise the parsers from Neovim takes precedent, which may be incompatible with some queries. # Otherwise the parsers from Neovim takes precedent, which may be incompatible with some queries.
(optionalString (cfg.settings.parser_install_dir != null) '' (optionalString (cfg.settings.parser_install_dir != null) ''
vim.opt.runtimepath:prepend(${helpers.toLuaObject cfg.settings.parser_install_dir}) vim.opt.runtimepath:prepend(${lib.nixvim.toLuaObject cfg.settings.parser_install_dir})
'') '')
+ '' + ''
require('nvim-treesitter.configs').setup(${helpers.toLuaObject cfg.settings}) require('nvim-treesitter.configs').setup(${lib.nixvim.toLuaObject cfg.settings})
'' ''
+ (optionalString (cfg.languageRegister != { }) '' + (optionalString (cfg.languageRegister != { }) ''
do do
local __parserFiletypeMappings = ${helpers.toLuaObject cfg.languageRegister} local __parserFiletypeMappings = ${lib.nixvim.toLuaObject cfg.languageRegister}
for parser_name, ft in pairs(__parserFiletypeMappings) do for parser_name, ft in pairs(__parserFiletypeMappings) do
require('vim.treesitter.language').register(parser_name, ft) require('vim.treesitter.language').register(parser_name, ft)

View file

@ -58,7 +58,7 @@ with lib;
setupOptions = with cfg; { inherit languages; } // cfg.extraOptions; setupOptions = with cfg; { inherit languages; } // cfg.extraOptions;
in in
'' ''
require('ts_context_commentstring').setup(${helpers.toLuaObject setupOptions}) require('ts_context_commentstring').setup(${lib.nixvim.toLuaObject setupOptions})
''; '';
}; };
} }

View file

@ -260,9 +260,9 @@ in
extraConfigLua = '' extraConfigLua = ''
wilder = require("wilder") wilder = require("wilder")
wilder.setup(${helpers.toLuaObject setupOptions}) wilder.setup(${lib.nixvim.toLuaObject setupOptions})
local __wilderOptions = ${helpers.toLuaObject options} local __wilderOptions = ${lib.nixvim.toLuaObject options}
for key, value in pairs(__wilderOptions) do for key, value in pairs(__wilderOptions) do
wilder.set_option(key, value) wilder.set_option(key, value)
end end

View file

@ -135,7 +135,7 @@ in
keymaps = filter (keymap: keymap != null) (attrValues cfg.keymaps); keymaps = filter (keymap: keymap != null) (attrValues cfg.keymaps);
extraConfigLua = '' extraConfigLua = ''
require("wtf").setup(${helpers.toLuaObject setupOptions}) require("wtf").setup(${lib.nixvim.toLuaObject setupOptions})
''; '';
}; };
} }

View file

@ -378,7 +378,7 @@ lib.nixvim.neovim-plugin.mkNeovimPlugin {
local utils = require('yanky.utils') local utils = require('yanky.utils')
${optionalString config.plugins.telescope.enable "local mapping = require('yanky.telescope.mapping')"} ${optionalString config.plugins.telescope.enable "local mapping = require('yanky.telescope.mapping')"}
require('yanky').setup(${helpers.toLuaObject cfg.settings}) require('yanky').setup(${lib.nixvim.toLuaObject cfg.settings})
end end
''; '';

View file

@ -176,7 +176,7 @@ in
server: server:
let let
updates = lib.concatMapStringsSep "\n" (name: '' updates = lib.concatMapStringsSep "\n" (name: ''
client.server_capabilities.${name} = ${helpers.toLuaObject server.capabilities.${name}} client.server_capabilities.${name} = ${lib.nixvim.toLuaObject server.capabilities.${name}}
'') (builtins.attrNames server.capabilities); '') (builtins.attrNames server.capabilities);
in in
'' ''
@ -230,7 +230,7 @@ in
do do
${cfg.preConfig} ${cfg.preConfig}
local __lspServers = ${helpers.toLuaObject cfg.enabledServers} local __lspServers = ${lib.nixvim.toLuaObject cfg.enabledServers}
-- Adding lspOnAttach function to nixvim module lua table so other plugins can hook into it. -- Adding lspOnAttach function to nixvim module lua table so other plugins can hook into it.
_M.lspOnAttach = function(client, bufnr) _M.lspOnAttach = function(client, bufnr)
${updateCapabilities} ${updateCapabilities}

View file

@ -216,7 +216,7 @@ in
patterns = {"."}, patterns = {"."},
fallback = false fallback = false
}, },
spec = ${helpers.toLuaObject packedPlugins} spec = ${lib.nixvim.toLuaObject packedPlugins}
} }
) )
''; '';

View file

@ -183,11 +183,11 @@ in
luaRockPlugins = luaRockListToLua cfg.rockPlugins; luaRockPlugins = luaRockListToLua cfg.rockPlugins;
luaRocksString = optionalString ( luaRocksString = optionalString (
cfg.rockPlugins != [ ] cfg.rockPlugins != [ ]
) "use_rocks ${helpers.toLuaObject luaRockPlugins}"; ) "use_rocks ${lib.nixvim.toLuaObject luaRockPlugins}";
in in
mkIf (cfg.plugins != [ ]) '' mkIf (cfg.plugins != [ ]) ''
require('packer').startup(function() require('packer').startup(function()
use ${helpers.toLuaObject packedPlugins} use ${lib.nixvim.toLuaObject packedPlugins}
${luaRocksString} ${luaRocksString}
end) end)
''; '';

View file

@ -50,7 +50,7 @@ let
results = lib.runTests { results = lib.runTests {
testToLuaObject = { testToLuaObject = {
expr = helpers.toLuaObject { expr = lib.nixvim.toLuaObject {
foo = "bar"; foo = "bar";
qux = [ qux = [
1 1
@ -62,22 +62,22 @@ let
}; };
testToLuaObjectRawLua = { testToLuaObjectRawLua = {
expr = helpers.toLuaObject { __raw = "<lua code>"; }; expr = lib.nixvim.toLuaObject { __raw = "<lua code>"; };
expected = "<lua code>"; expected = "<lua code>";
}; };
testToLuaObjectInlineLua = { testToLuaObjectInlineLua = {
expr = helpers.toLuaObject (lib.generators.mkLuaInline "<lua code>"); expr = lib.nixvim.toLuaObject (lib.generators.mkLuaInline "<lua code>");
expected = "(<lua code>)"; expected = "(<lua code>)";
}; };
testToLuaObjectInlineLuaNested = { testToLuaObjectInlineLuaNested = {
expr = helpers.toLuaObject { lua = lib.generators.mkLuaInline "<lua code>"; }; expr = lib.nixvim.toLuaObject { lua = lib.generators.mkLuaInline "<lua code>"; };
expected = "{ lua = (<lua code>) }"; expected = "{ lua = (<lua code>) }";
}; };
testToLuaObjectLuaTableMixingList = { testToLuaObjectLuaTableMixingList = {
expr = helpers.toLuaObject { expr = lib.nixvim.toLuaObject {
"__unkeyed...." = "foo"; "__unkeyed...." = "foo";
bar = "baz"; bar = "baz";
}; };
@ -85,7 +85,7 @@ let
}; };
testToLuaObjectNestedAttrs = { testToLuaObjectNestedAttrs = {
expr = helpers.toLuaObject { expr = lib.nixvim.toLuaObject {
a = { a = {
b = 1; b = 1;
c = 2; c = 2;
@ -98,7 +98,7 @@ let
}; };
testToLuaObjectNestedList = { testToLuaObjectNestedList = {
expr = helpers.toLuaObject [ expr = lib.nixvim.toLuaObject [
1 1
2 2
[ [
@ -115,7 +115,7 @@ let
}; };
testToLuaObjectNonStringPrims = { testToLuaObjectNonStringPrims = {
expr = helpers.toLuaObject { expr = lib.nixvim.toLuaObject {
a = 1.0; a = 1.0;
b = 2; b = 2;
c = true; c = true;
@ -126,24 +126,24 @@ let
}; };
testToLuaObjectNilPrim = { testToLuaObjectNilPrim = {
expr = helpers.toLuaObject null; expr = lib.nixvim.toLuaObject null;
expected = "nil"; expected = "nil";
}; };
testToLuaObjectStringPrim = { testToLuaObjectStringPrim = {
expr = helpers.toLuaObject '' expr = lib.nixvim.toLuaObject ''
foo\bar foo\bar
baz''; baz'';
expected = ''"foo\\bar\nbaz"''; expected = ''"foo\\bar\nbaz"'';
}; };
testToLuaObjectDerivation = { testToLuaObjectDerivation = {
expr = helpers.toLuaObject drv; expr = lib.nixvim.toLuaObject drv;
expected = ''"${drv}"''; expected = ''"${drv}"'';
}; };
testToLuaObjectDerivationNested = { testToLuaObjectDerivationNested = {
expr = helpers.toLuaObject { expr = lib.nixvim.toLuaObject {
a = drv; a = drv;
b = { b = {
c = drv; c = drv;
@ -155,7 +155,7 @@ let
}; };
testToLuaObjectFilters = { testToLuaObjectFilters = {
expr = helpers.toLuaObject { expr = lib.nixvim.toLuaObject {
a = null; a = null;
b = { }; b = { };
c = [ ]; c = [ ];
@ -168,7 +168,7 @@ let
}; };
testToLuaObjectAttrListFilters = { testToLuaObjectAttrListFilters = {
expr = helpers.toLuaObject { expr = lib.nixvim.toLuaObject {
a = null; a = null;
b = { }; b = { };
c = [ ]; c = [ ];
@ -217,7 +217,7 @@ let
}; };
testToLuaObjectEmptyTable = { testToLuaObjectEmptyTable = {
expr = helpers.toLuaObject { expr = lib.nixvim.toLuaObject {
a = null; a = null;
b = { }; b = { };
c = { c = {