neovim-flake/modules/plugins/runner/run-nvim/config.nix

41 lines
1 KiB
Nix
Raw Normal View History

2024-11-21 22:03:28 +01:00
{
lib,
config,
options,
...
}: let
inherit (lib.modules) mkIf mkDefault;
2024-12-03 16:28:31 +01:00
inherit (lib.nvim.binds) mkKeymap;
2024-11-21 22:03:28 +01:00
cfg = config.vim.runner.run-nvim;
2024-12-03 16:28:31 +01:00
inherit (options.vim.runner.run-nvim) mappings;
2024-11-21 22:03:28 +01:00
in {
config = mkIf cfg.enable {
vim = {
lazy.plugins.run-nvim = {
package = "run-nvim";
setupModule = "run";
inherit (cfg) setupOpts;
cmd = "Run";
keys = [
2024-12-03 16:28:31 +01:00
(mkKeymap "n" cfg.mappings.run "<cmd>Run<CR>" {desc = mappings.run.description;})
(mkKeymap "n" cfg.mappings.runOverride "<cmd>Run!<CR>" {desc = mappings.runOverride.description;})
(mkKeymap "n" cfg.mappings.runCommand ''
function()
local input = vim.fn.input("Run command: ")
if input ~= "" then require("run").run(input, false) end
end
'' {
desc = mappings.run.description;
lua = true;
})
2024-11-21 22:03:28 +01:00
];
};
binds.whichKey.register."<leader>r" = mkDefault "+Run";
};
};
}