Function: evil-backward-char

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

Signature

(evil-backward-char &optional COUNT CROSSLINES NOERROR)

Documentation

Move cursor to the left by COUNT characters.

Movement is restricted to the current line unless CROSSLINES is non-nil. If NOERROR is non-nil, don't signal an error upon reaching the beginning of the line or the buffer; just return nil.

Key Bindings

Source Code

;; Defined in ~/.emacs.d/elpa/evil-20251108.138/evil-commands.el
(evil-define-motion evil-backward-char (count &optional crosslines noerror)
  "Move cursor to the left by COUNT characters.
Movement is restricted to the current line unless CROSSLINES is non-nil.
If NOERROR is non-nil, don't signal an error upon reaching the beginning
of the line or the buffer; just return nil."
  :type exclusive
  (interactive "<c>" (list evil-cross-lines
                           (evil-kbd-macro-suppress-motion-error)))
  (cond
   ((not crosslines)
    ;; Restrict movement to the current line
    (evil-with-restriction
        (max (- (point) (or count 1)) (point-min))
        (min (1+ (point)) (point-max))
      (condition-case err
          (evil-narrow-to-line (backward-char count))
        (error
         ;; Restore the previous command (this one never happened).
         ;; This preserves the current column if the previous command
         ;; was `evil-next-line' or `evil-previous-line'.
         (setq this-command last-command)
         (unless noerror (signal (car err) (cdr err)))))))
   (noerror (ignore-errors (evil-backward-char count crosslines)))
   (t (evil-motion-loop (nil (or count 1))
        (backward-char)
        ;; don't put the cursor on a newline
        (unless (or (evil-visual-state-p) (evil-operator-state-p))
          (evil-adjust-cursor))))))