Module bex.param

Stock parameter handlers

This module contains parameter handlers or factories for use when setting up commands in bex.cmd

Functions

default (ctx) Default parameter handler.
fname (ctx) Filename parameter handler.
quote (ctx) Single quote parameter handler.
squote (ctx) Double quote parameter handler.
raw (ctx) Raw parameter handler.
cmd (bridge_ns) Command parameter handler (factory).
plusplusopt (ctx) ++opt parameter handler.
plusopt (ctx) +opt parameter handler.
minusopt (ctx) -opt parameter handler.
star (inner) Kleene-star like parameter handler factory.
call (func) Call simple function (factory).


Functions

default (ctx)
Default parameter handler.

One parameter in, one token out. Escapes only spaces and backslash.

Parameters:

  • ctx
fname (ctx)
Filename parameter handler.

One parameter in, one token out. Escapes as a filename.

Parameters:

  • ctx
quote (ctx)
Single quote parameter handler.

One parameter in, one token out. Surrounds with single quotes.

Parameters:

  • ctx
squote (ctx)
Double quote parameter handler.

One paramter in, one token out. Surrounds with double quotes, escaping contents.

Parameters:

  • ctx
raw (ctx)
Raw parameter handler.

One paramter in, one token out. Performs no escaping.

Parameters:

  • ctx
cmd (bridge_ns)
Command parameter handler (factory).

Returns a parameter handler that formats an Ex command, e.g. for autocmd and similar that take a trailing command as a parameter.

If bridge_ns is provided, a callable as a parameter will result in a command that calls it with no arguments. Otherwise, all remaining parameters are emited as raw tokens.

Parameters:

  • bridge_ns An optional namespace for bridging Lua functions. See bex.bridge.

Returns:

    A new handler.
plusplusopt (ctx)
++opt parameter handler.

Emits a ++opt style parameter verbatim if it matches, and does nothing otherwise. Suitable for use with bex.param.star.

Parameters:

  • ctx
plusopt (ctx)
+opt parameter handler.

Emits a +opt style parameter verbatim if it matches, and does nothing otherwise. Suitable for use with bex.param.star.

Parameters:

  • ctx
minusopt (ctx)
-opt parameter handler.

Emits a -opt style parameter verbatim if it matches, and does nothing otherwise. Suitable for use with bex.param.star.

Parameters:

  • ctx
star (inner)
Kleene-star like parameter handler factory.

Runs another handler until it returns falsity. Useful with bex.param.plusplusopt, etc.

Parameters:

  • inner The inner parameter handler

Returns:

    A new handler.
call (func)
Call simple function (factory).

Handles a single parameter by passing it to a function and emiting the result as a raw token.

Parameters:

  • func The function.

Returns:

    A new handler.
generated by LDoc 1.4.6 Last updated 2021-06-29 21:08:43