binds
layer
#
The binds
layer allows you to define custom bindings declaratively.
Configuration #
This layer’s configuration is an array. Each key is a table, and must have the following fields:
mode
: mode short name (see{mode}
);bind
: binding trigger (see{lhs}
);opts
: additional (non-mandatory) options (see{opts}
). Should containdesc
, a description of the binding (used by thewhichkey
layer).
Each value is a function to be invoked when the binding is triggered.
Examples #
-- path/of/your/vim/config/init.lua
require("visimp")({
binds = {
[{
mode = 'n', -- When in normal mode...
bind = '<leader>h', -- and pressing <leader>h...
opts = {
desc = 'Show date and time' -- (description for whichkey layer)
}
}] = function ()
print(os.date()) -- ...print the current date and time
end
}
})