Bind

bind #

Utilities for binding vi keys to actions


methods #


M.is_valid #


function M.is_valid(bind: table) -> result boolean

@param bind - The bind object

@return result - True if the bind is valid, false otherwise

Checks if a bind object is correct

M.map #


function M.map(
  map: table,
  fn: function
) ->  nil

@param map - The mapping object

@param fn - The call handler

Maps a mapping object ({ mode, bind, opts }) to a function in lua Assumes valid input data

M.get_registered #


function M.get_registered() -> binds table[]

@return binds - The list of registered keymap structures (the right-hand-side of a bind assignment)

Returns the list of registered keymaps This can be used by layers to act upon registered custom binds

M.bind #


function M.bind(
  binds: table,
  handler: (function[]|function|nil),
  buffer: (integer|nil)
) ->  nil

@param binds - The list of binds in a correct format

@param handler - Either a table of bind actions or a function for manually assigning a bind function to a key (or neither)

@param buffer - A buffer identifier if all binds want to be registered as local to a certain buffer. Nil otherwise.

Sets up the list of binds with the given list/function of handlers

M.vim_cmd_cb #


function M.vim_cmd_cb(command: string) -> cb function

@param command - Vim command to invoke (w/o the colon prefix)

@return cb - The constructed callback

Constructs callbacks that simply invoke the specified vim command

fields #


M.registered #


M.registered: table