run-nvim: fix keymaps

This commit is contained in:
diniamo 2024-12-03 16:28:31 +01:00
parent ce21e1f98a
commit 88834cc93f

View file

@ -5,11 +5,10 @@
...
}: let
inherit (lib.modules) mkIf mkDefault;
inherit (lib.nvim.binds) addDescriptionsToMappings mkSetLznBinding mkSetLuaLznBinding;
inherit (lib.nvim.binds) mkKeymap;
cfg = config.vim.runner.run-nvim;
mappingDefinitions = options.vim.runner.run-nvim.mappings;
mappings = addDescriptionsToMappings cfg.mappings mappingDefinitions;
inherit (options.vim.runner.run-nvim) mappings;
in {
config = mkIf cfg.enable {
vim = {
@ -21,14 +20,17 @@ in {
cmd = "Run";
keys = [
(mkSetLznBinding "n" mappings.run "<cmd>Run<CR>")
(mkSetLznBinding "n" mappings.runOverride "<cmd>Run!<CR>")
(mkSetLuaLznBinding "n" mappings.runCommand ''
function()
local input = vim.fn.input("Run command: ")
if input ~= "" then require("run").run(input, false) end
end
'')
(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;
})
];
};