Function: evil-scroll-up

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

Signature

(evil-scroll-up COUNT)

Documentation

Scroll the window and the cursor COUNT lines upwards.

If COUNT is not specified the function scrolls up evil-scroll-count lines, which is the last used count. If the scroll count is zero the command scrolls half the screen.

Key Bindings

Source Code

;; Defined in ~/.emacs.d/elpa/evil-20251108.138/evil-commands.el
;; With `scroll-preserve-screen-position' `scroll-up'/`scroll-down'
;; target the same cursor pixel Y-coordinate while `last-command' has
;; the `scroll-command' property. However the target needs updating
;; when e.g. scrolling maximally to the first or last line and then
;; switching scroll direction. Do this by resetting `last-command'
;; when `real-this-command' (`evil-ensure-column' modifies
;; `this-command') changed from last value:

(evil-define-command evil-scroll-up (count)
  "Scroll the window and the cursor COUNT lines upwards.
If COUNT is not specified the function scrolls up `evil-scroll-count'
lines, which is the last used count.
If the scroll count is zero the command scrolls half the screen."
  :repeat nil
  :keep-visual t
  (interactive "<c>")
  (when (= (line-beginning-position) (point-min))
    (signal 'beginning-of-buffer nil))
  (setq count (evil--get-scroll-count count))
  (evil-ensure-column
    (let ((opoint (point)))
      (condition-case nil
          (let ((scroll-preserve-screen-position 'always)
                (last-command (when (eq real-last-command real-this-command)
                                real-last-command)))
            (scroll-down count))
        (:success
         ;; Redo if `scroll-down' only did partial scroll up to BOB
         (when (<= (window-start) (point-min))
           (goto-char opoint)
           (vertical-motion (- count))))
        (beginning-of-buffer (vertical-motion (- count)))))))