Function: evil-jump-item
evil-jump-item is an interactive and byte-compiled function defined in
evil-commands.el.
Signature
(evil-jump-item &optional COUNT)
Documentation
Find the next item in this line after or under the cursor and jump to the corresponding one.
Key Bindings
Source Code
;; Defined in ~/.emacs.d/elpa/evil-20251108.138/evil-commands.el
(evil-define-motion evil-jump-item (count)
"Find the next item in this line after or under the cursor
and jump to the corresponding one."
:jump t
:type inclusive
(cond
;; COUNT% jumps to a line COUNT percentage down the file
(count
(evil-ensure-column
(goto-char
(let ((size (- (point-max) (point-min))))
(+ (point-min)
(if (> size 80000)
(* count (/ size 100))
(/ (* count size) 100))))))
(setq evil-this-type 'line))
((and (evil-looking-at-start-comment t)
(let ((pnt (point)))
(forward-comment 1)
(or (not (bolp))
(prog1 nil (goto-char pnt)))))
(backward-char))
((and (not (eolp)) (evil-looking-at-end-comment t))
(forward-comment -1))
((and
(memq major-mode '(c-mode c++-mode c-ts-mode c++-ts-mode))
(require 'hideif nil t)
(with-no-warnings
(let* ((hif-else-regexp (concat hif-cpp-prefix "\\(?:else\\|elif[ \t]+\\)"))
(hif-ifx-else-endif-regexp
(concat hif-ifx-regexp "\\|" hif-else-regexp "\\|" hif-endif-regexp)))
(cond
((save-excursion (beginning-of-line) (or (hif-looking-at-ifX) (hif-looking-at-else)))
(hif-find-next-relevant)
(while (hif-looking-at-ifX)
(hif-ifdef-to-endif)
(hif-find-next-relevant))
t)
((save-excursion (beginning-of-line) (hif-looking-at-endif))
(hif-endif-to-ifdef)
t))))))
(t
(let* ((open (point-max))
(close (point-max))
(open-pair (ignore-errors
(save-excursion
;; consider the character right before eol given that
;; point may be placed there, e.g. in visual state
(when (and (eolp) (not (bolp)))
(backward-char))
(setq open (1- (scan-lists (point) 1 -1)))
(when (< open (line-end-position))
(goto-char open)
(forward-list)
(1- (point))))))
(close-pair (ignore-errors
(save-excursion
;; consider the character right before eol given that
;; point may be placed there, e.g. in visual state
(when (and (eolp) (not (bolp)))
(backward-char))
(setq close (1- (scan-lists (point) 1 1)))
(when (< close (line-end-position))
(goto-char (1+ close))
(backward-list)
(point))))))
(cond
((not (or open-pair close-pair))
;; nothing found, check if we are inside a string
(let ((pnt (point))
(bnd (bounds-of-thing-at-point 'evil-string)))
(if (not (and bnd (< (point) (cdr bnd))))
;; no, then we really failed
(user-error "No matching item found on the current line")
;; yes, go to the end of the string and try again
(let ((endstr (cdr bnd)))
(when (or (save-excursion
(goto-char endstr)
(let ((b (bounds-of-thing-at-point 'evil-string)))
(and b (< (point) (cdr b))))) ; not at end of string
(condition-case nil
(progn
(goto-char endstr)
(evil-jump-item)
nil)
(error t)))
;; failed again, go back to original point
(goto-char pnt)
(user-error "No matching item found on the current line"))))))
((< open close) (goto-char open-pair))
(t (goto-char close-pair)))))))