1
0
Fork 0
mirror of https://github.com/nix-community/nixvim.git synced 2025-11-08 19:46:06 +01:00
nixvim/plugins/by-name/better-escape/default.nix
saygo-png 29ec33e1a8 plugins: remove deprecations "after 24.11" or less
Signed-off-by: saygo-png <saygo.mail@proton.me>
2025-10-18 18:31:00 +00:00

72 lines
1.8 KiB
Nix

{
lib,
helpers,
...
}:
with lib;
lib.nixvim.plugins.mkNeovimPlugin {
name = "better-escape";
moduleName = "better_escape";
package = "better-escape-nvim";
description = "A Neovim plugin to quickly exit insert mode without losing your typed text.";
maintainers = [ maintainers.GaetanLepage ];
settingsOptions = {
timeout = helpers.defaultNullOpts.mkStrLuaOr types.ints.unsigned "vim.o.timeoutlen" ''
The time in which the keys must be hit in ms.
Uses the value of `vim.o.timeoutlen` (`options.timeoutlen` in nixvim) by default.
'';
default_mappings = helpers.defaultNullOpts.mkBool true ''
Whether to enable default key mappings.
'';
mappings = helpers.defaultNullOpts.mkAttrsOf' {
type = types.anything;
pluginDefault = {
i.j = {
k = "<Esc>";
j = "<Esc>";
};
c.j = {
k = "<Esc>";
j = "<Esc>";
};
t.j = {
k = "<Esc>";
j = "<Esc>";
};
v.j.k = "<Esc>";
s.j.k = "<Esc>";
};
example.i." "."<tab>".__raw = ''
function()
-- Defer execution to avoid side-effects
vim.defer_fn(function()
-- set undo point
vim.o.ul = vim.o.ul
require("luasnip").expand_or_jump()
end, 1)
end
'';
description = "Define mappings for each mode.";
};
};
settingsExample = {
timeout = "vim.o.timeoutlen";
mapping = {
i." "."<tab>".__raw = ''
function()
-- Defer execution to avoid side-effects
vim.defer_fn(function()
-- set undo point
vim.o.ul = vim.o.ul
require("luasnip").expand_or_jump()
end, 1)
end
'';
};
};
}