hl.define_submap

hl.define_submap(name, fn)

Define a named keybind submap.

Signature

hl.define_submap(name: string, fn: function): nil
hl.define_submap(name: string, reset: string, fn: function): nil

Parameters

namestring

Submap name.

resetstring, optional

Reset submap name used for binds defined inside this submap.

fnfunction

Function called while the submap is active during config evaluation. Binds created inside this callback are assigned to the submap.

Returns

nil

This function defines the submap and does not return a value.

Examples

hl.define_submap("resize", function()
    hl.bind("H", hl.dsp.window.resize({ x = -20, y = 0, relative = true }))
    hl.bind("L", hl.dsp.window.resize({ x = 20, y = 0, relative = true }))
    hl.bind("Escape", hl.dsp.submap("reset"))
end)

See also

hl.bind()

Register binds inside a submap.

hl.dsp.submap()

Create a dispatcher that changes submaps.