Flexible key mapping manager.
nvim-insx is a flexible key mapping manager.
https://github.com/hrsh7th/nvim-insx/assets/629908/ad878d95-c541-4d6c-b135-139d511602b8
preset
if it incorporates breaking changes
.
This plugin provides no default mappings. You need to define your custom mappings as follows.
require('insx.preset.standard').setup()
local insx = require('insx')
insx.add(
"'",
insx.with(require('insx.recipe.auto_pair')({
open = "'",
close = "'"
}), {
insx.with.in_string(false),
insx.with.in_comment(false),
insx.with.nomatch([[\\\%#]]),
insx.with.nomatch([[\a\%#]])
})
)
-- Simple pair deletion recipe.
local function your_recipe(option)
return {
action = function(ctx)
if option.allow_space then
ctx.remove([[\s*\%#\s*]])
end
ctx.send('<BS><Right><BS>')
end,
enabled = function(ctx)
if option.allow_space then
return ctx.match([[(\s*\%#\s*)]])
end
return ctx.match([[(\%#)]])
end
}
end
The standard preset enables some advanced features.
The API is stable except for the helper-related APIs.
Bug report & feature request are welcome.