Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

userCommands

A list of user commands to add to the configuration.

Type: attribute set of (submodule)

Default:

{ }

Declared by:

userCommands.<name>.addr

Whether special characters relate to other things, see :h command-addr.

Type: null or string

Default:

null

Declared by:

userCommands.<name>.bang

Whether this command can take a bang (!).

Type: null or boolean or raw lua code

Default: null

Plugin default: false

Declared by:

userCommands.<name>.bar

Whether this command can be followed by a “|” and another command.

Type: null or boolean or raw lua code

Default: null

Plugin default: false

Declared by:

userCommands.<name>.command

The command to run.

Type: string or raw lua code

Declared by:

userCommands.<name>.complete

Tab-completion behaviour, see :h command-complete.

Type: null or string or raw lua code

Default:

null

Declared by:

userCommands.<name>.count

Whether the command accepts a count, see :h command-range.

Type: null or boolean or signed integer

Default:

null

Declared by:

userCommands.<name>.desc

A description of the command.

Type: null or string or raw lua code

Default: null

Plugin default: ""

Declared by:

userCommands.<name>.force

Overwrite an existing user command.

Type: null or boolean or raw lua code

Default: null

Plugin default: false

Declared by:

userCommands.<name>.keepscript

Do not use the location of where the user command was defined for verbose messages, use the location of where the command was invoked.

Type: null or boolean or raw lua code

Default: null

Plugin default: false

Declared by:

userCommands.<name>.nargs

The number of arguments to expect, see :h command-nargs.

Type: null or one of 0, 1, “*”, “?”, “+”

Default:

null

Declared by:

userCommands.<name>.preview

Preview handler for 'inccommand', see :h command-preview.

The function is called with opts, ns, and buf arguments. opts has the same form as nvim_create_user_command() callbacks, ns is the preview highlight namespace, and buf is the preview buffer for inccommand=split or nil for inccommand=nosplit.

Return 0 to show no preview, 1 to show a preview without opening the preview window, or 2 to open the preview window when inccommand=split.

Type: null or lua function string

Default:

null

Example:

''
  function(opts, ns, buf)
    if buf then
      vim.api.nvim_buf_set_lines(buf, 0, -1, false, { opts.args })
    end
    return 2
  end
''

Declared by:

userCommands.<name>.range

Whether the command accepts a range, see :h command-range.

Type: null or boolean or signed integer or value “%” (singular enum)

Default:

null

Declared by:

userCommands.<name>.register

The first argument to the command can be an optional register.

Type: null or boolean or raw lua code

Default: null

Plugin default: false

Declared by: