Which characters in a vimscript command are invalid?
Is there are blacklist or a whitelist of characters?
Currently, I've only come up with these characters that trigger the error
Invalid command name
_
-
.
!
:
Thanks!
Vi and Vim Stack Exchange is a question and answer site for people using the vi and Vim families of text editors. It only takes a minute to sign up.
Sign up to join this communityWhich characters in a vimscript command are invalid?
Is there are blacklist or a whitelist of characters?
Currently, I've only come up with these characters that trigger the error
Invalid command name
_
-
.
!
:
Thanks!
See :help user-commands
All user defined commands must start with an uppercase letter, to avoid confusion with builtin commands. Exceptions are these builtin commands: :Next :X They cannot be used for a user defined command. ":Print" is also an existing command, but it is deprecated and can be overruled.
The other characters of the user command can be uppercase letters, lowercase letters or digits. When using digits, note that other commands that take a numeric argument may become ambiguous. For example, the command ":Cc2" could be the user command ":Cc2" without an argument, or the command ":Cc" with argument "2". It is advised to put a space between the command name and the argument to avoid these problems.
When using a user-defined command, the command can be abbreviated. However, if an abbreviation is not unique, an error will be issued. Furthermore, a built-in command will always take precedence.