Home Explore Blog CI



neovim

16th chunk of `runtime/doc/motion.txt`
6c1154e2ea1b23ad825e070a4913160734f264b18f298c750000000100000fa1
 set
you can move through a tree of jump locations. When going back up a branch and
then down another branch, CTRL-O still takes you further up the tree.

Given a jumplist like the following in which CTRL-O has been used to move back
three times to location X: >

     jump line  col file/text
       2  1260    8 mark.c		<-- location X-2
       1   685    0 eval.c		<-- location X-1
    >  0   462   36 eval.c		<-- location X
       1   479   39 eval.c
       2   213    2 mark.c
       3   181    0 mark.c
<
jumping to (new) location Y results in the locations after the current
locations being removed: >

     jump line  col file/text
       3  1260    8 mark.c		<-- location X-2
       2   685    0 eval.c		<-- location X-1
       1   462   36 eval.c		<-- location X
    >
<
Then, when yet another location Z is jumped to, the new location Y appears
directly after location X in the jumplist and location X remains in the same
position relative to the locations (X-1, X-2, etc., ...) that had been before
it prior to the original jump from X to Y: >

     jump line  col file/text
       4  1260    8 mark.c		<-- location X-2
       3   685    0 eval.c		<-- location X-1
       2   462   36 eval.c		<-- location X
       1   100    0 buffer.c		<-- location Y
    >
<
CHANGE LIST JUMPS			*changelist* *change-list-jumps* *E664*

When making a change the cursor position is remembered.  One position is
remembered for every change that can be undone, unless it is close to a
previous change.  Two commands can be used to jump to positions of changes,
also those that have been undone:

							*g;* *E662*
g;			Go to [count] older position in change list.
			If [count] is larger than the number of older change
			positions go to the oldest change.
			If there is no older change an error message is given.
			(not a motion command)

							*g,* *E663*
g,			Go to [count] newer position in change list.
			Just like |g;| but in the opposite direction.
			(not a motion command)

When using a count you jump as far back or forward as possible.  Thus you can
use "999g;" to go to the first change for which the position is still
remembered.  The number of entries in the change list is fixed and is the same
as for the |jumplist|.

When two undo-able changes are in the same line and at a column position less
than 'textwidth' apart only the last one is remembered.  This avoids that a
sequence of small changes in a line, for example "xxxxx", adds many positions
to the change list.  When 'textwidth' is zero 'wrapmargin' is used.  When that
also isn't set a fixed number of 79 is used.  Detail: For the computations
bytes are used, not characters, to avoid a speed penalty (this only matters
for multibyte encodings).

Note that when text has been inserted or deleted the cursor position might be
a bit different from the position of the change.  Especially when lines have
been deleted.

When the `:keepjumps` command modifier is used the position of a change is not
remembered.

							*:changes*
:changes		Print the change list.  A ">" character indicates the
			current position.  Just after a change it is below the
			newest entry, indicating that `g;` takes you to the
			newest entry position.  The first column indicates the
			count needed to take you to this position.  Example:

				change line  col text ~
				    3     9    8 bla bla bla
				    2    11   57 foo is a bar
				    1    14   54 the latest changed line
				>

			The `3g;` command takes you to line 9.  Then the
			output of `:changes` is:

				change line  col text ~
				>   0     9    8 bla bla bla
				    1    11   57 foo is a bar
				    2    14   54 the latest changed line

			Now you can use "g," to go to line 11 and "2g," to go
			to line 14.

==============================================================================
9. Various motions				*various-motions*

							*%*
%			Find the next item in this line after or under the
			cursor and jump to its match. |inclusive| motion.
			Items can be:
			([{}])

Title: Vim Change List Jumps and Various Motions
Summary
This section details the change list feature in Vim, explaining how it stores cursor positions after changes and how to navigate these changes using 'g;' and 'g,'. It discusses the fixed size of the change list, the conditions under which changes are recorded, and the impact of text insertion or deletion on cursor positions. The section also explains the ":changes" command and the '%' motion.