Function: evil-view

evil-view is an interactive and byte-compiled function defined in evil-commands.el.

Signature

(evil-view FILE &optional BANG)

Documentation

Open FILE but don't allow changes.

If no FILE is specified, reload the current buffer from disk as read-only.

Key Bindings

Source Code

;; Defined in ~/.emacs.d/elpa/evil-20251108.138/evil-commands.el
(evil-define-command evil-view (file &optional bang)
  "Open FILE but don't allow changes.
If no FILE is specified, reload the current buffer from disk as read-only."
  :repeat nil
  (interactive "<f><!>")
  (if file
      (find-file-read-only file)
    (revert-buffer bang (or bang (not (buffer-modified-p))) t)
    (read-only-mode +1)))