Function: evil-command-window
evil-command-window is an interactive and byte-compiled function
defined in evil-command-window.el.
Signature
(evil-command-window HISTORY PROMPT EXECUTE-FN)
Documentation
Open a command-line window for HISTORY with PROMPT and EXECUTE-FN.
HISTORY should be a list of commands. PROMPT should be the command-line prompt (one of ":", "/" or "?"). EXECUTE-FN should be a unary function to execute on the result that the user selects.
If called interactively, edit this minibuffer argument.
Key Bindings
Aliases
evil-ex-search-command-window (obsolete since 1.15.0)
evil-ex-command-window (obsolete since 1.15.0)
Source Code
;; Defined in ~/.emacs.d/elpa/evil-20251108.138/evil-command-window.el
(defun evil-command-window (history prompt execute-fn)
"Open a command-line window for HISTORY with PROMPT and EXECUTE-FN.
HISTORY should be a list of commands. PROMPT should be the
command-line prompt (one of \":\", \"/\" or \"?\"). EXECUTE-FN should
be a unary function to execute on the result that the user selects.
If called interactively, edit this minibuffer argument."
(interactive
(list (cons (minibuffer-contents) (minibuffer-history-value))
(or (minibuffer-prompt) (user-error "Minibuffer is inactive"))
#'evil--command-window-minibuffer-execute))
(when (derived-mode-p 'evil-command-window-mode)
(user-error "Command-line window is already open"))
(when (evil-ex-p) (evil-ex-teardown))
(let ((previous-buffer (current-buffer))
(buffer (get-buffer-create "*Command Line*")))
(with-current-buffer buffer
(erase-buffer)
(evil-command-window-mode)
(setq-local evil-command-window-current-buffer previous-buffer)
(setq-local evil-command-window-execute-fn execute-fn)
(setq-local evil--command-window-prompt prompt)
(evil--command-window-insert-commands history))
(let* ((action
`((display-buffer-reuse-window display-buffer-at-bottom)
,@(unless (zerop evil-command-window-height)
`((window-height body-lines . ,evil-command-window-height)
(preserve-size nil . t)))
(dedicated . t)))
(window (display-buffer buffer action))
(delete-window-fun
(lambda (window)
(set-window-parameter window 'delete-window nil)
(delete-window window)
(switch-to-minibuffer))))
(when (minibufferp)
(set-window-parameter window 'delete-window delete-window-fun))
(select-window window)))
(goto-char (point-max))
(unless (bobp) (backward-char) (evil-adjust-cursor)))