Listing Neovim User-Commands

Sometimes it can be helpful to list out the names of the currently-defined user-commands.

The quick and simple way to the list user-commands is using the :command command, as follows:

:command

When invoked, this command passes a sorted list of all user-commands to the messages window, along with some useful information about each user-command, including the number of arguments the user-command accepts and the definition of the user-command.

The definition can take several forms depending on how the user-command was defined. When the {command} argument was defined as a string, that string is included. When {command} was defined as a lua function, then the path to the file containing that function is listed, which can be very handy when trying to locate the code for a particular user-command.

:command accepts an argument, which will be used as a case-sensitive prefix-match to filter the list of user-commands. For example to see only user-commands with names that start with "Abc":

:command Abc

Finally, :command can also be used with :verbose to get a little bit more information about when each entry in the listing was created:

:verbose command Abc