Function: evil-ex-define-cmd
evil-ex-define-cmd is a byte-compiled function defined in evil-ex.el.
Signature
(evil-ex-define-cmd CMD FUNCTION)
Documentation
Bind the function FUNCTION to the command CMD.
Source Code
;; Defined in ~/.emacs.d/elpa/evil-20251108.138/evil-ex.el
(defun evil-ex-define-cmd (cmd function)
"Bind the function FUNCTION to the command CMD."
(if (not (string-match-p "\\[" cmd))
(evil--add-to-alist evil-ex-commands cmd function)
(string-match "\\(.*\\)\\[\\(.*\\)\\]" cmd)
(let ((mandatory (match-string 1 cmd))
(optional (match-string 2 cmd)))
(dotimes (n (1+ (length optional)))
(evil--add-to-alist evil-ex-commands
(concat mandatory (substring optional 0 n))
function)))))