mirror of
https://github.com/nix-community/nixvim.git
synced 2025-06-20 16:15:43 +02:00
treewide (cleaning): helpers.toLuaObject -> lib.nixvim.toLuaObject
This commit is contained in:
parent
78e295fa41
commit
ec24d496d5
65 changed files with 104 additions and 104 deletions
|
@ -58,7 +58,7 @@
|
|||
(lib.optionalString (autoGroups != { }) ''
|
||||
-- Set up autogroups {{
|
||||
do
|
||||
local __nixvim_autogroups = ${helpers.toLuaObject autoGroups}
|
||||
local __nixvim_autogroups = ${lib.nixvim.toLuaObject autoGroups}
|
||||
|
||||
for group_name, options in pairs(__nixvim_autogroups) do
|
||||
vim.api.nvim_create_augroup(group_name, options)
|
||||
|
@ -69,7 +69,7 @@
|
|||
+ (lib.optionalString (autoCmd != [ ]) ''
|
||||
-- Set up autocommands {{
|
||||
do
|
||||
local __nixvim_autocommands = ${helpers.toLuaObject autoCmd}
|
||||
local __nixvim_autocommands = ${lib.nixvim.toLuaObject autoCmd}
|
||||
|
||||
for _, autocmd in ipairs(__nixvim_autocommands) do
|
||||
vim.api.nvim_create_autocmd(
|
||||
|
|
|
@ -73,7 +73,7 @@ in
|
|||
in
|
||||
lib.mkIf (config.userCommands != { }) {
|
||||
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
|
||||
vim.api.nvim_create_user_command(name, cmd.command, cmd.options or {})
|
||||
end
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
|
||||
config = {
|
||||
extraConfigLuaPre = lib.mkIf (config.diagnostics != { }) ''
|
||||
vim.diagnostic.config(${helpers.toLuaObject config.diagnostics})
|
||||
vim.diagnostic.config(${lib.nixvim.toLuaObject config.diagnostics})
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
|
|
@ -58,6 +58,6 @@ in
|
|||
config.extraConfigLua =
|
||||
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})
|
||||
'';
|
||||
}
|
||||
|
|
|
@ -42,7 +42,7 @@
|
|||
''
|
||||
-- Highlight groups {{
|
||||
do
|
||||
local highlights = ${helpers.toLuaObject config.highlight}
|
||||
local highlights = ${lib.nixvim.toLuaObject config.highlight}
|
||||
|
||||
for k,v in pairs(highlights) do
|
||||
vim.api.nvim_set_hl(0, k, v)
|
||||
|
@ -56,7 +56,7 @@
|
|||
''
|
||||
-- Highlight groups {{
|
||||
do
|
||||
local highlights = ${helpers.toLuaObject config.highlightOverride}
|
||||
local highlights = ${lib.nixvim.toLuaObject config.highlightOverride}
|
||||
|
||||
for k,v in pairs(highlights) do
|
||||
vim.api.nvim_set_hl(0, k, v)
|
||||
|
@ -72,7 +72,7 @@
|
|||
''
|
||||
-- Match groups {{
|
||||
do
|
||||
local match = ${helpers.toLuaObject config.match}
|
||||
local match = ${lib.nixvim.toLuaObject config.match}
|
||||
|
||||
for k,v in pairs(match) do
|
||||
vim.fn.matchadd(k, v)
|
||||
|
|
|
@ -81,7 +81,7 @@
|
|||
extraConfigLua = lib.mkIf (config.keymaps != [ ]) ''
|
||||
-- Set up keybinds {{{
|
||||
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
|
||||
vim.keymap.set(map.mode, map.key, map.action, map.options)
|
||||
end
|
||||
|
@ -99,7 +99,7 @@
|
|||
callback = helpers.mkRaw ''
|
||||
function()
|
||||
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
|
||||
vim.keymap.set(map.mode, map.key, map.action, map.options)
|
||||
end
|
||||
|
|
|
@ -67,7 +67,7 @@ in
|
|||
}:
|
||||
let
|
||||
varName = "nixvim_${luaVariableName}";
|
||||
optionDefinitions = helpers.toLuaObject config.${optionName};
|
||||
optionDefinitions = lib.nixvim.toLuaObject config.${optionName};
|
||||
in
|
||||
lib.optionalString (optionDefinitions != "{ }") ''
|
||||
-- Set up ${prettyName} {{{
|
||||
|
|
|
@ -86,7 +86,7 @@ in
|
|||
};
|
||||
in
|
||||
''
|
||||
require('autoclose').setup(${helpers.toLuaObject setupOptions})
|
||||
require('autoclose').setup(${lib.nixvim.toLuaObject setupOptions})
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
|
|
@ -516,7 +516,7 @@ in
|
|||
extraPlugins = [ cfg.package ];
|
||||
|
||||
extraConfigLua = ''
|
||||
vim.api.nvim_set_var("chadtree_settings", ${helpers.toLuaObject setupOptions})
|
||||
vim.api.nvim_set_var("chadtree_settings", ${lib.nixvim.toLuaObject setupOptions})
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
|
|
@ -265,7 +265,7 @@ in
|
|||
extraPlugins = [ cfg.package ];
|
||||
|
||||
plugins.lsp.postConfig = ''
|
||||
require("clangd_extensions").setup(${helpers.toLuaObject setupOptions})
|
||||
require("clangd_extensions").setup(${lib.nixvim.toLuaObject setupOptions})
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
|
|
@ -153,7 +153,7 @@ in
|
|||
// cfg.extraOptions;
|
||||
in
|
||||
''
|
||||
require('clipboard-image').setup(${helpers.toLuaObject setupOptions})
|
||||
require('clipboard-image').setup(${lib.nixvim.toLuaObject setupOptions})
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
|
|
@ -214,7 +214,7 @@ in
|
|||
// cfg.extraOptions;
|
||||
in
|
||||
''
|
||||
require('copilot').setup(${helpers.toLuaObject setupOptions})
|
||||
require('copilot').setup(${lib.nixvim.toLuaObject setupOptions})
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
|
2
plugins/by-name/coq-thirdparty/default.nix
vendored
2
plugins/by-name/coq-thirdparty/default.nix
vendored
|
@ -66,7 +66,7 @@ in
|
|||
extraPlugins = [ cfg.package ];
|
||||
|
||||
extraConfigLua = ''
|
||||
require('coq_3p')(${helpers.toLuaObject cfg.sources})
|
||||
require('coq_3p')(${lib.nixvim.toLuaObject cfg.sources})
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
|
|
@ -267,7 +267,7 @@ in
|
|||
extraPlugins = [ cfg.package ];
|
||||
|
||||
extraConfigLua = ''
|
||||
require("coverage").setup(${helpers.toLuaObject setupOptions})
|
||||
require("coverage").setup(${lib.nixvim.toLuaObject setupOptions})
|
||||
'';
|
||||
|
||||
keymaps = flatten (
|
||||
|
|
|
@ -55,7 +55,7 @@ in
|
|||
extraPlugins = [ cfg.package ];
|
||||
|
||||
extraConfigLua = ''
|
||||
require('nvim-cursorline').setup(${helpers.toLuaObject options})
|
||||
require('nvim-cursorline').setup(${lib.nixvim.toLuaObject options})
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
|
|
@ -61,7 +61,7 @@ in
|
|||
plugins.dap = {
|
||||
enable = true;
|
||||
extensionConfigLua = ''
|
||||
require("dap-go").setup(${helpers.toLuaObject options})
|
||||
require("dap-go").setup(${lib.nixvim.toLuaObject options})
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
|
|
@ -239,7 +239,7 @@ in
|
|||
enable = true;
|
||||
|
||||
extensionConfigLua = ''
|
||||
require("dapui").setup(${helpers.toLuaObject options});
|
||||
require("dapui").setup(${lib.nixvim.toLuaObject options});
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
|
|
@ -94,7 +94,7 @@ in
|
|||
enable = true;
|
||||
|
||||
extensionConfigLua = ''
|
||||
require("nvim-dap-virtual-text").setup(${helpers.toLuaObject options});
|
||||
require("nvim-dap-virtual-text").setup(${lib.nixvim.toLuaObject options});
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
|
|
@ -90,13 +90,13 @@ with dapHelpers;
|
|||
|
||||
extraConfigLua =
|
||||
(optionalString (cfg.adapters != null) ''
|
||||
require("dap").adapters = ${helpers.toLuaObject options.adapters}
|
||||
require("dap").adapters = ${lib.nixvim.toLuaObject options.adapters}
|
||||
'')
|
||||
+ (optionalString (options.configurations != null) ''
|
||||
require("dap").configurations = ${helpers.toLuaObject options.configurations}
|
||||
require("dap").configurations = ${lib.nixvim.toLuaObject options.configurations}
|
||||
'')
|
||||
+ (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
|
||||
vim.fn.sign_define(sign_name, sign)
|
||||
end
|
||||
|
|
|
@ -835,7 +835,7 @@ in
|
|||
extraPlugins = [ cfg.package ];
|
||||
|
||||
extraConfigLua = ''
|
||||
require("diffview").setup(${helpers.toLuaObject setupOptions})
|
||||
require("diffview").setup(${lib.nixvim.toLuaObject setupOptions})
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
|
|
@ -677,7 +677,7 @@ in
|
|||
// cfg.extraOptions;
|
||||
in
|
||||
''
|
||||
require("fidget").setup${helpers.toLuaObject setupOptions}
|
||||
require("fidget").setup${lib.nixvim.toLuaObject setupOptions}
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
|
|
@ -135,7 +135,7 @@ lib.nixvim.neovim-plugin.mkNeovimPlugin {
|
|||
if isString mapping then
|
||||
"${mapping}()"
|
||||
else
|
||||
"${mapping.action}(${helpers.toLuaObject mapping.settings})";
|
||||
"${mapping.action}(${lib.nixvim.toLuaObject mapping.settings})";
|
||||
in
|
||||
{
|
||||
inherit key;
|
||||
|
|
|
@ -85,7 +85,7 @@ in
|
|||
telescopeCfg = ''require("telescope").load_extension("git_worktree")'';
|
||||
in
|
||||
''
|
||||
require('git-worktree').setup(${helpers.toLuaObject setupOptions})
|
||||
require('git-worktree').setup(${lib.nixvim.toLuaObject setupOptions})
|
||||
${if cfg.enableTelescope then telescopeCfg else ""}
|
||||
'';
|
||||
};
|
||||
|
|
|
@ -103,7 +103,7 @@ with lib;
|
|||
// cfg.extraOptions;
|
||||
in
|
||||
''
|
||||
require('gitlinker').setup(${helpers.toLuaObject setupOptions})
|
||||
require('gitlinker').setup(${lib.nixvim.toLuaObject setupOptions})
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
|
|
@ -205,7 +205,7 @@ in
|
|||
telescopeCfg = ''require("telescope").load_extension("harpoon")'';
|
||||
in
|
||||
''
|
||||
require('harpoon').setup(${helpers.toLuaObject setupOptions})
|
||||
require('harpoon').setup(${lib.nixvim.toLuaObject setupOptions})
|
||||
${if cfg.enableTelescope then telescopeCfg else ""}
|
||||
'';
|
||||
|
||||
|
|
|
@ -39,9 +39,9 @@ lib.nixvim.neovim-plugin.mkNeovimPlugin {
|
|||
plugins.hydra.luaConfig.content = ''
|
||||
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
|
||||
hydra(hydra_config)
|
||||
end
|
||||
|
|
|
@ -150,7 +150,7 @@ in
|
|||
extraPlugins = [ cfg.package ];
|
||||
|
||||
extraConfigLua = ''
|
||||
require("illuminate").configure(${helpers.toLuaObject setupOptions})
|
||||
require("illuminate").configure(${lib.nixvim.toLuaObject setupOptions})
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
|
|
@ -166,7 +166,7 @@ in
|
|||
// cfg.extraOptions;
|
||||
in
|
||||
''
|
||||
require('image').setup(${helpers.toLuaObject setupOptions})
|
||||
require('image').setup(${lib.nixvim.toLuaObject setupOptions})
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
|
|
@ -55,7 +55,7 @@ with lib;
|
|||
extraPlugins = [ cfg.package ];
|
||||
|
||||
extraConfigLua = ''
|
||||
require("inc_rename").setup(${helpers.toLuaObject setupOptions})
|
||||
require("inc_rename").setup(${lib.nixvim.toLuaObject setupOptions})
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
|
|
@ -48,7 +48,7 @@ with lib;
|
|||
extraPlugins = [ cfg.package ];
|
||||
|
||||
extraConfigLua = ''
|
||||
require('nvim-lastplace').setup(${helpers.toLuaObject options})
|
||||
require('nvim-lastplace').setup(${lib.nixvim.toLuaObject options})
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
|
|
@ -301,7 +301,7 @@ in
|
|||
// cfg.extraOptions;
|
||||
in
|
||||
''
|
||||
require("lean").setup(${helpers.toLuaObject setupOptions})
|
||||
require("lean").setup(${lib.nixvim.toLuaObject setupOptions})
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
|
|
@ -183,7 +183,7 @@ in
|
|||
+ (optionalString (options != { }) ''
|
||||
require('leap').opts = vim.tbl_deep_extend(
|
||||
"keep",
|
||||
${helpers.toLuaObject options},
|
||||
${lib.nixvim.toLuaObject options},
|
||||
require('leap').opts
|
||||
)
|
||||
'');
|
||||
|
|
|
@ -233,7 +233,7 @@ in
|
|||
extraConfigLua =
|
||||
''
|
||||
__lint = require('lint')
|
||||
__lint.linters_by_ft = ${helpers.toLuaObject cfg.lintersByFt}
|
||||
__lint.linters_by_ft = ${lib.nixvim.toLuaObject cfg.lintersByFt}
|
||||
''
|
||||
+ (optionalString (cfg.linters != { }) (
|
||||
concatLines (
|
||||
|
@ -244,7 +244,7 @@ in
|
|||
propName: propValue:
|
||||
optionalString (
|
||||
propValue != null
|
||||
) ''__lint.linters["${linter}"]["${propName}"] = ${helpers.toLuaObject propValue}''
|
||||
) ''__lint.linters["${linter}"]["${propName}"] = ${lib.nixvim.toLuaObject propValue}''
|
||||
) linterConfig
|
||||
) cfg.linters
|
||||
)
|
||||
|
@ -257,7 +257,7 @@ in
|
|||
let
|
||||
linterConfig' = if isString linterConfig then helpers.mkRaw linterConfig else linterConfig;
|
||||
in
|
||||
''__lint.linters["${customLinter}"] = ${helpers.toLuaObject linterConfig'}''
|
||||
''__lint.linters["${customLinter}"] = ${lib.nixvim.toLuaObject linterConfig'}''
|
||||
) cfg.customLinters
|
||||
)
|
||||
));
|
||||
|
|
|
@ -75,21 +75,21 @@ in
|
|||
extraPlugins = [ cfg.package ];
|
||||
|
||||
extraConfigLua = optionalString (!doCmp) ''
|
||||
require('lspkind').init(${helpers.toLuaObject options})
|
||||
require('lspkind').init(${lib.nixvim.toLuaObject options})
|
||||
'';
|
||||
|
||||
plugins.cmp.settings.formatting.format =
|
||||
if cfg.cmp.after != null then
|
||||
''
|
||||
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)
|
||||
end
|
||||
''
|
||||
else
|
||||
''
|
||||
require('lspkind').cmp_format(${helpers.toLuaObject options})
|
||||
require('lspkind').cmp_format(${lib.nixvim.toLuaObject options})
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
|
|
@ -636,7 +636,7 @@ in
|
|||
// cfg.extraOptions;
|
||||
in
|
||||
''
|
||||
require('lspsaga').setup(${helpers.toLuaObject setupOptions})
|
||||
require('lspsaga').setup(${lib.nixvim.toLuaObject setupOptions})
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
|
|
@ -55,7 +55,7 @@ lib.nixvim.neovim-plugin.mkNeovimPlugin {
|
|||
enable = true;
|
||||
|
||||
onAttach.function = ''
|
||||
require("ltex_extra").setup(${helpers.toLuaObject cfg.settings})
|
||||
require("ltex_extra").setup(${lib.nixvim.toLuaObject cfg.settings})
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
|
|
@ -186,18 +186,18 @@ in
|
|||
] loader;
|
||||
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: ''
|
||||
require("luasnip").filetype_extend("${n}", ${helpers.toLuaObject v})
|
||||
require("luasnip").filetype_extend("${n}", ${lib.nixvim.toLuaObject v})
|
||||
'') cfg.filetypeExtend;
|
||||
|
||||
extraConfig = [
|
||||
''
|
||||
require("luasnip").config.setup(${helpers.toLuaObject cfg.settings})
|
||||
require("luasnip").config.setup(${lib.nixvim.toLuaObject cfg.settings})
|
||||
''
|
||||
];
|
||||
in
|
||||
|
|
|
@ -42,7 +42,7 @@ in
|
|||
extraPlugins = [ cfg.package ];
|
||||
|
||||
extraConfigLua = ''
|
||||
require("mark-radar").setup(${helpers.toLuaObject setupOptions})
|
||||
require("mark-radar").setup(${lib.nixvim.toLuaObject setupOptions})
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
|
|
@ -184,7 +184,7 @@ in
|
|||
// cfg.extraOptions;
|
||||
in
|
||||
''
|
||||
require('marks').setup(${helpers.toLuaObject setupOptions})
|
||||
require('marks').setup(${lib.nixvim.toLuaObject setupOptions})
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
|
|
@ -645,7 +645,7 @@ in
|
|||
extraPlugins = [ cfg.package ];
|
||||
|
||||
extraConfigLua = ''
|
||||
require("mkdnflow").setup(${helpers.toLuaObject setupOptions})
|
||||
require("mkdnflow").setup(${lib.nixvim.toLuaObject setupOptions})
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
|
|
@ -243,7 +243,7 @@ in
|
|||
extraPlugins = [ cfg.package ];
|
||||
|
||||
extraConfigLua = ''
|
||||
require("multicursors").setup(${helpers.toLuaObject setupOptions})
|
||||
require("multicursors").setup(${lib.nixvim.toLuaObject setupOptions})
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
|
|
@ -267,7 +267,7 @@ in
|
|||
|
||||
extraConfigLua = ''
|
||||
local actions = require("nvim-navbuddy.actions")
|
||||
require('nvim-navbuddy').setup(${helpers.toLuaObject setupOptions})
|
||||
require('nvim-navbuddy').setup(${lib.nixvim.toLuaObject setupOptions})
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1136,7 +1136,7 @@ in
|
|||
];
|
||||
|
||||
extraConfigLua = ''
|
||||
require('neo-tree').setup(${helpers.toLuaObject setupOptions})
|
||||
require('neo-tree').setup(${lib.nixvim.toLuaObject setupOptions})
|
||||
'';
|
||||
|
||||
extraPackages = [ cfg.gitPackage ];
|
||||
|
|
|
@ -202,7 +202,7 @@ in
|
|||
extraPlugins = [ cfg.package ];
|
||||
|
||||
extraConfigLua = ''
|
||||
require("neogen").setup(${helpers.toLuaObject setupOptions})
|
||||
require("neogen").setup(${lib.nixvim.toLuaObject setupOptions})
|
||||
'';
|
||||
|
||||
keymaps = flatten (
|
||||
|
|
|
@ -47,12 +47,12 @@ in
|
|||
config = mkIf cfg.enable {
|
||||
extraPlugins = [ cfg.package ];
|
||||
extraConfigLua = ''
|
||||
local __ignored_variables = ${helpers.toLuaObject cfg.ignoredVariables}
|
||||
local __ignored_variables = ${lib.nixvim.toLuaObject cfg.ignoredVariables}
|
||||
for ignoredVariable, shouldIgnore in ipairs(__ignored_variables) do
|
||||
require("nix-develop").ignored_variables[ignoredVariable] = shouldIgnore
|
||||
end
|
||||
|
||||
local __separated_variables = ${helpers.toLuaObject cfg.separatedVariables}
|
||||
local __separated_variables = ${lib.nixvim.toLuaObject cfg.separatedVariables}
|
||||
for variable, separator in ipairs(__separated_variables) do
|
||||
require("nix-develop").separated_variables[variable] = separator
|
||||
end
|
||||
|
|
|
@ -125,7 +125,7 @@ in
|
|||
|
||||
extraConfigLua = ''
|
||||
vim.notify = require('notify');
|
||||
require('notify').setup(${helpers.toLuaObject setupOptions})
|
||||
require('notify').setup(${lib.nixvim.toLuaObject setupOptions})
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
|
|
@ -164,7 +164,7 @@ in
|
|||
extraPlugins = [ cfg.package ];
|
||||
|
||||
extraConfigLua = ''
|
||||
require('bqf').setup(${helpers.toLuaObject options})
|
||||
require('bqf').setup(${lib.nixvim.toLuaObject options})
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
|
|
@ -143,7 +143,7 @@ in
|
|||
pattern = "java";
|
||||
callback.__raw = ''
|
||||
function ()
|
||||
require('jdtls').start_or_attach(${helpers.toLuaObject options})
|
||||
require('jdtls').start_or_attach(${lib.nixvim.toLuaObject options})
|
||||
end
|
||||
'';
|
||||
}
|
||||
|
|
|
@ -117,7 +117,7 @@ with lib;
|
|||
];
|
||||
|
||||
extraConfigLua = ''
|
||||
require('osc52').setup(${helpers.toLuaObject setupOptions})
|
||||
require('osc52').setup(${lib.nixvim.toLuaObject setupOptions})
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1113,7 +1113,7 @@ in
|
|||
|
||||
-- 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.
|
||||
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
|
||||
-- change to the directory
|
||||
|
@ -1131,7 +1131,7 @@ in
|
|||
-- Will automatically open the tree when running setup if startup buffer is a file.
|
||||
-- File window will be focused.
|
||||
-- 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
|
||||
local real_file = vim.fn.filereadable(data.file) == 1
|
||||
|
@ -1140,7 +1140,7 @@ in
|
|||
|
||||
-- skip ignored filetypes
|
||||
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
|
||||
-- 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.
|
||||
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
|
||||
require("nvim-tree.api").tree.open()
|
||||
end
|
||||
|
@ -1189,7 +1189,7 @@ in
|
|||
(optionalString autoOpenEnabled openNvimTreeFunction)
|
||||
+ ''
|
||||
|
||||
require('nvim-tree').setup(${helpers.toLuaObject setupOptions})
|
||||
require('nvim-tree').setup(${lib.nixvim.toLuaObject setupOptions})
|
||||
'';
|
||||
|
||||
extraPackages = [ cfg.gitPackage ];
|
||||
|
|
|
@ -226,7 +226,7 @@ in
|
|||
// cfg.extraOptions;
|
||||
in
|
||||
''
|
||||
require('ollama').setup(${helpers.toLuaObject setupOptions})
|
||||
require('ollama').setup(${lib.nixvim.toLuaObject setupOptions})
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
|
|
@ -73,7 +73,7 @@ with lib;
|
|||
};
|
||||
in
|
||||
''
|
||||
require('persistence').setup(${helpers.toLuaObject opts})
|
||||
require('persistence').setup(${lib.nixvim.toLuaObject opts})
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
|
|
@ -212,7 +212,7 @@ in
|
|||
mkIf cfg.enable {
|
||||
extraPlugins = [ cfg.package ];
|
||||
extraConfigLua = ''
|
||||
require("presence").setup${helpers.toLuaObject setupOptions}
|
||||
require("presence").setup${lib.nixvim.toLuaObject setupOptions}
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
|
|
@ -136,7 +136,7 @@ lib.nixvim.vim-plugin.mkVimPlugin {
|
|||
plugins.lsp.servers = {
|
||||
jsonls.settings = mkIf cfg.json.enable {
|
||||
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.
|
||||
|
@ -155,7 +155,7 @@ lib.nixvim.vim-plugin.mkVimPlugin {
|
|||
};
|
||||
|
||||
schemas.__raw = ''
|
||||
require('schemastore').yaml.schemas(${helpers.toLuaObject cfg.yaml.settings})
|
||||
require('schemastore').yaml.schemas(${lib.nixvim.toLuaObject cfg.yaml.settings})
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
|
|
@ -74,7 +74,7 @@ in
|
|||
keymaps = mappings;
|
||||
|
||||
extraConfigLua = ''
|
||||
require("${pluginName}").setup(${helpers.toLuaObject setupOptions})
|
||||
require("${pluginName}").setup(${lib.nixvim.toLuaObject setupOptions})
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
|
|
@ -334,10 +334,10 @@ in
|
|||
} // sections;
|
||||
in
|
||||
''
|
||||
require('startup').setup(${helpers.toLuaObject setupOptions})
|
||||
require('startup').setup(${lib.nixvim.toLuaObject setupOptions})
|
||||
''
|
||||
+ (optionalString (
|
||||
cfg.userMappings != { }
|
||||
) "require('startup').create_mappings(${helpers.toLuaObject cfg.userMappings})");
|
||||
) "require('startup').create_mappings(${lib.nixvim.toLuaObject cfg.userMappings})");
|
||||
};
|
||||
}
|
||||
|
|
|
@ -432,14 +432,14 @@ lib.nixvim.neovim-plugin.mkNeovimPlugin {
|
|||
# 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.
|
||||
(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 != { }) ''
|
||||
do
|
||||
local __parserFiletypeMappings = ${helpers.toLuaObject cfg.languageRegister}
|
||||
local __parserFiletypeMappings = ${lib.nixvim.toLuaObject cfg.languageRegister}
|
||||
|
||||
for parser_name, ft in pairs(__parserFiletypeMappings) do
|
||||
require('vim.treesitter.language').register(parser_name, ft)
|
||||
|
|
|
@ -58,7 +58,7 @@ with lib;
|
|||
setupOptions = with cfg; { inherit languages; } // cfg.extraOptions;
|
||||
in
|
||||
''
|
||||
require('ts_context_commentstring').setup(${helpers.toLuaObject setupOptions})
|
||||
require('ts_context_commentstring').setup(${lib.nixvim.toLuaObject setupOptions})
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
|
|
@ -260,9 +260,9 @@ in
|
|||
|
||||
extraConfigLua = ''
|
||||
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
|
||||
wilder.set_option(key, value)
|
||||
end
|
||||
|
|
|
@ -135,7 +135,7 @@ in
|
|||
keymaps = filter (keymap: keymap != null) (attrValues cfg.keymaps);
|
||||
|
||||
extraConfigLua = ''
|
||||
require("wtf").setup(${helpers.toLuaObject setupOptions})
|
||||
require("wtf").setup(${lib.nixvim.toLuaObject setupOptions})
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
|
|
@ -378,7 +378,7 @@ lib.nixvim.neovim-plugin.mkNeovimPlugin {
|
|||
local utils = require('yanky.utils')
|
||||
${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
|
||||
'';
|
||||
|
||||
|
|
|
@ -176,7 +176,7 @@ in
|
|||
server:
|
||||
let
|
||||
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);
|
||||
in
|
||||
''
|
||||
|
@ -230,7 +230,7 @@ in
|
|||
do
|
||||
${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.
|
||||
_M.lspOnAttach = function(client, bufnr)
|
||||
${updateCapabilities}
|
||||
|
|
|
@ -216,7 +216,7 @@ in
|
|||
patterns = {"."},
|
||||
fallback = false
|
||||
},
|
||||
spec = ${helpers.toLuaObject packedPlugins}
|
||||
spec = ${lib.nixvim.toLuaObject packedPlugins}
|
||||
}
|
||||
)
|
||||
'';
|
||||
|
|
|
@ -183,11 +183,11 @@ in
|
|||
luaRockPlugins = luaRockListToLua cfg.rockPlugins;
|
||||
luaRocksString = optionalString (
|
||||
cfg.rockPlugins != [ ]
|
||||
) "use_rocks ${helpers.toLuaObject luaRockPlugins}";
|
||||
) "use_rocks ${lib.nixvim.toLuaObject luaRockPlugins}";
|
||||
in
|
||||
mkIf (cfg.plugins != [ ]) ''
|
||||
require('packer').startup(function()
|
||||
use ${helpers.toLuaObject packedPlugins}
|
||||
use ${lib.nixvim.toLuaObject packedPlugins}
|
||||
${luaRocksString}
|
||||
end)
|
||||
'';
|
||||
|
|
|
@ -50,7 +50,7 @@ let
|
|||
|
||||
results = lib.runTests {
|
||||
testToLuaObject = {
|
||||
expr = helpers.toLuaObject {
|
||||
expr = lib.nixvim.toLuaObject {
|
||||
foo = "bar";
|
||||
qux = [
|
||||
1
|
||||
|
@ -62,22 +62,22 @@ let
|
|||
};
|
||||
|
||||
testToLuaObjectRawLua = {
|
||||
expr = helpers.toLuaObject { __raw = "<lua code>"; };
|
||||
expr = lib.nixvim.toLuaObject { __raw = "<lua code>"; };
|
||||
expected = "<lua code>";
|
||||
};
|
||||
|
||||
testToLuaObjectInlineLua = {
|
||||
expr = helpers.toLuaObject (lib.generators.mkLuaInline "<lua code>");
|
||||
expr = lib.nixvim.toLuaObject (lib.generators.mkLuaInline "<lua code>");
|
||||
expected = "(<lua code>)";
|
||||
};
|
||||
|
||||
testToLuaObjectInlineLuaNested = {
|
||||
expr = helpers.toLuaObject { lua = lib.generators.mkLuaInline "<lua code>"; };
|
||||
expr = lib.nixvim.toLuaObject { lua = lib.generators.mkLuaInline "<lua code>"; };
|
||||
expected = "{ lua = (<lua code>) }";
|
||||
};
|
||||
|
||||
testToLuaObjectLuaTableMixingList = {
|
||||
expr = helpers.toLuaObject {
|
||||
expr = lib.nixvim.toLuaObject {
|
||||
"__unkeyed...." = "foo";
|
||||
bar = "baz";
|
||||
};
|
||||
|
@ -85,7 +85,7 @@ let
|
|||
};
|
||||
|
||||
testToLuaObjectNestedAttrs = {
|
||||
expr = helpers.toLuaObject {
|
||||
expr = lib.nixvim.toLuaObject {
|
||||
a = {
|
||||
b = 1;
|
||||
c = 2;
|
||||
|
@ -98,7 +98,7 @@ let
|
|||
};
|
||||
|
||||
testToLuaObjectNestedList = {
|
||||
expr = helpers.toLuaObject [
|
||||
expr = lib.nixvim.toLuaObject [
|
||||
1
|
||||
2
|
||||
[
|
||||
|
@ -115,7 +115,7 @@ let
|
|||
};
|
||||
|
||||
testToLuaObjectNonStringPrims = {
|
||||
expr = helpers.toLuaObject {
|
||||
expr = lib.nixvim.toLuaObject {
|
||||
a = 1.0;
|
||||
b = 2;
|
||||
c = true;
|
||||
|
@ -126,24 +126,24 @@ let
|
|||
};
|
||||
|
||||
testToLuaObjectNilPrim = {
|
||||
expr = helpers.toLuaObject null;
|
||||
expr = lib.nixvim.toLuaObject null;
|
||||
expected = "nil";
|
||||
};
|
||||
|
||||
testToLuaObjectStringPrim = {
|
||||
expr = helpers.toLuaObject ''
|
||||
expr = lib.nixvim.toLuaObject ''
|
||||
foo\bar
|
||||
baz'';
|
||||
expected = ''"foo\\bar\nbaz"'';
|
||||
};
|
||||
|
||||
testToLuaObjectDerivation = {
|
||||
expr = helpers.toLuaObject drv;
|
||||
expr = lib.nixvim.toLuaObject drv;
|
||||
expected = ''"${drv}"'';
|
||||
};
|
||||
|
||||
testToLuaObjectDerivationNested = {
|
||||
expr = helpers.toLuaObject {
|
||||
expr = lib.nixvim.toLuaObject {
|
||||
a = drv;
|
||||
b = {
|
||||
c = drv;
|
||||
|
@ -155,7 +155,7 @@ let
|
|||
};
|
||||
|
||||
testToLuaObjectFilters = {
|
||||
expr = helpers.toLuaObject {
|
||||
expr = lib.nixvim.toLuaObject {
|
||||
a = null;
|
||||
b = { };
|
||||
c = [ ];
|
||||
|
@ -168,7 +168,7 @@ let
|
|||
};
|
||||
|
||||
testToLuaObjectAttrListFilters = {
|
||||
expr = helpers.toLuaObject {
|
||||
expr = lib.nixvim.toLuaObject {
|
||||
a = null;
|
||||
b = { };
|
||||
c = [ ];
|
||||
|
@ -217,7 +217,7 @@ let
|
|||
};
|
||||
|
||||
testToLuaObjectEmptyTable = {
|
||||
expr = helpers.toLuaObject {
|
||||
expr = lib.nixvim.toLuaObject {
|
||||
a = null;
|
||||
b = { };
|
||||
c = {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue