Home Explore Blog CI



neovim

1st chunk of `runtime/doc/motion.txt`
ace673db69d6691658410cd6a9369f3b07599bbdd2facd1d0000000100000fa0
*motion.txt*    Nvim


		  VIM REFERENCE MANUAL    by Bram Moolenaar


Cursor motions					*cursor-motions* *navigation*

These commands move the cursor position.  If the new position is off of the
screen, the screen is scrolled to show the cursor (see also 'scrolljump' and
'scrolloff' options).

General remarks:

If you want to know where you are in the file use the "CTRL-G" command
|CTRL-G| or the "g CTRL-G" command |g_CTRL-G|.  If you set the 'ruler' option,
the cursor position is continuously shown in the status line (which slows down
Vim a little).

Experienced users prefer the hjkl keys because they are always right under
their fingers.  Beginners often prefer the arrow keys, because they do not
know what the hjkl keys do.  The mnemonic value of hjkl is clear from looking
at the keyboard.  Think of j as an arrow pointing downwards.

The 'virtualedit' option can be set to make it possible to move the cursor to
positions where there is no character or within a multi-column character (like
a tab).

                                      Type |gO| to see the table of contents.

==============================================================================
1. Motions and operators				*operator*

The motion commands can be used after an operator command, to have the command
operate on the text that was moved over.  That is the text between the cursor
position before and after the motion.  Operators are generally used to delete
or change text.  The following operators are available:

	|c|	c	change
	|d|	d	delete
	|y|	y	yank into register (does not change the text)
	|~|	~	swap case (only if 'tildeop' is set)
	|g~|	g~	swap case
	|gu|	gu	make lowercase
	|gU|	gU	make uppercase
	|!|	!	filter through an external program
	|=|	=	filter through 'equalprg' or C-indenting if empty
	|gq|	gq	text formatting
	|gw|	gw	text formatting with no cursor movement
	|g?|	g?	ROT13 encoding
	|>|	>	shift right
	|<|	<	shift left
	|zf|	zf	define a fold
	|g@|	g@	call function set with the 'operatorfunc' option
						*motion-count-multiplied*
If the motion includes a count and the operator also had a count before it,
the two counts are multiplied.  For example: "2d3w" deletes six words.
						*operator-doubled*
When doubling the operator it operates on a line.  When using a count, before
or after the first character, that many lines are operated upon.  Thus `3dd`
deletes three lines. A count before and after the first character is
multiplied, thus `2y3y` yanks six lines.
						*operator-resulting-pos*
After applying the operator the cursor is mostly left at the start of the text
that was operated upon.  For example, "yfe" doesn't move the cursor, but "yFe"
moves the cursor leftwards to the "e" where the yank started.
The 'startofline' option applies only to the "d", "<<", "==" and ">>" linewise
operations.

						*linewise* *charwise* *characterwise*
The operator either affects whole lines, or the characters between the start
and end position.  Generally, motions that move between lines affect lines
(are linewise), and motions that move within a line affect characters (are
charwise).  However, there are some exceptions.

						*exclusive* *inclusive*
Character motion is either inclusive or exclusive.  When inclusive, the
start and end position of the motion are included in the operation.  When
exclusive, the last character towards the end of the buffer is not included.
Linewise motions always include the start and end position.  Plugins can
check the v:event.inclusive flag of the |TextYankPost| event.

Which motions are linewise, inclusive or exclusive is mentioned with the
command.  There are however, two general exceptions:
1. If the motion is exclusive and the end of the motion is in column 1, the
   end of the motion is moved to the end of the previous line and the motion
   becomes inclusive.  Example: "}" moves to the first line after a paragraph,
   but "d}" will not include that line.
						*exclusive-linewise*
2. If the motion is exclusive, the end of

Title: Cursor Motions and Operators in Vim
Summary
This section of the Vim documentation explains cursor motions and operators. It covers general remarks about cursor movement, including using hjkl keys or arrow keys, and the 'virtualedit' option. It lists available operators like delete, change, yank, and filter, explaining how they work with motions and counts. It also details the concepts of linewise, charwise, inclusive, and exclusive motions and their effect on operators.