Function: evil-exit-visual-state

evil-exit-visual-state is an interactive and byte-compiled function defined in evil-states.el.

Signature

(evil-exit-visual-state &optional LATER BUFFER)

Documentation

Exit from Visual state to the previous state.

If LATER is non-nil, exit after the current command.

Key Bindings

Source Code

;; Defined in ~/.emacs.d/elpa/evil-20251108.138/evil-states.el
(evil-define-command evil-exit-visual-state (&optional later buffer)
  "Exit from Visual state to the previous state.
If LATER is non-nil, exit after the current command."
  :keep-visual t
  :repeat abort
  (with-current-buffer (or buffer (current-buffer))
    (when (evil-visual-state-p)
      (if later
          (setq deactivate-mark t)
        (when evil-visual-region-expanded
          (evil-visual-contract-region))
        (setq evil-this-register nil
              evil-prev-visual-selection evil-visual-selection
              evil-prev-visual-mark (copy-marker evil-visual-mark)
              evil-prev-visual-point (copy-marker evil-visual-point))
        (evil-change-to-previous-state)))))