Layer

layer #

Utilities for constructing and identifying layers


methods #


M.new_layer #


function M.new_layer(id: string) -> layer table

@param id - The layer identifier

@return layer - The newly created layer

Returns an empty new layer for the given identifier

M.is_layer #


function M.is_layer(layer: table) -> result boolean

@param layer - The hypothetical layer to analyze

@return result - Whether the provided argument is a layer

Returns true if the given argument is a proper layer

M.to_vimscript_config #


function M.to_vimscript_config(
  layer: table,
  vim_config_field: string,
  prefix_mode: boolean,
  layer_config_field: (string|nil),
  blacklist: (table|nil)
) ->  nil

@param layer - The layer whose config is to be exported

@param vim_config_field - The name of the global vimscript variable storing the plugin config, or the common prefix shared by all the plugin config fields if these are stored as individual vimscript global variables.

@param prefix_mode - True(ish) if the vim_config_field parameter should be interpreted as a prefix common to all the plugin config fields, or false(ish) if it should just be the global vimscript variable storing the plugin config.

@param layer_config_field - The field in the layer config where the plugin config is stored. If the plugin config is stored at the root of the layer config, nil should be passed instead.

@param blacklist - A list of fields that should not be copied from the layer config (as they do not belong to the plugin config). If nil, it is considered to be empty.

Exports a layer config as a vimscript plugin config (i.e., vim global variables)