Class chorus.usercmd.Spec

class chorus.usercmd.Spec: vim.api.keyset.user_command

User command spec

Specifies how to create one or more user commands

buffer: (boolean | integer)?

Create command only for given buffer; 0 or true mean the current buffer. Default: false

addr: string?

Address range handling

bang: boolean?

Command accepts !. Default: false

bar: boolean?

Command can be followed by a | and another command. Default: false

complete: (string | function)?

Completion rule. Default: none

count: (integer | boolean)?

Count accepted.

  1. false: Count not accepted (default)

  2. n: A count (default n) is specified in the line number position or first argument

  3. true: Acts like 0

desc: string?

A description of the command. Default: none

force: boolean?

Override previous definition. Default: true

keepscript: boolean?

Use location of command invocation for verbose messages. Default: false

nargs: (0 | 1 | "*" | "?" | "+")?

Argument count.

  1. 0: No arguments allowed (default)

  2. 1: One argument required

  3. '*': Any number of whitespace-separated arguments are allowed

  4. '?': 0 or 1 arguments allowed

  5. '+': One or more arguments required

preview: (function)?

Preview callback

range: (boolean | "%" | integer)?

Range allowed

  1. false: Range not accepted (default)

  2. true: Range accepted, default is current line

  3. '%': Range accepted, default is whole file

  4. n: A count (default n) is specified in the line number position

register: boolean?

The first argument to the command can be an optional register name. Default: false

[string]: (string | chorus.usercmd.Spec)

Nested specification

  1. "<name>" = "<cmd>": Command name and ex command to run

  2. "<name>" = function(args) .. end Command name and function to run

  3. "<name>" = { .... } Nested specification (should not provide name) which inherits options from parent table

[integer]: (string | chorus.usercmd.Func | chorus.usercmd.Spec)

Positional arguments

  1. "<name>", "<cmd>": Command name and ex command to run

  2. "<name>", function(args) ... end: Command name and function to run

  3. { ... }, ...: Nested user command specs which inherit options from the parent table