Home Explore Blog CI



neovim

10th chunk of `runtime/doc/motion.txt`
fe896c050da65cede2ad61aa9e3ffbcd7e46a79b688df38b0000000100000fa0
 "inner" commands: If the cursor was on the object, the
	operator applies to the object.  If the cursor was on white space, the
	operator applies to the white space.
For a block object:
	The operator applies to the block where the cursor is in, or the block
	on which the cursor is on one of the braces.  For the "inner" commands
	the surrounding braces are excluded.  For the "a" commands, the braces
	are included.

							*v_object-select*
When used in Visual mode:
When start and end of the Visual area are the same (just after typing "v"):
	One object is selected, the same as for using an operator.
When start and end of the Visual area are not the same:
	For non-block objects the area is extended by one object or the white
	space up to the next object, or both for the "a" objects.  The
	direction in which this happens depends on which side of the Visual
	area the cursor is.  For the block objects the block is extended one
	level outwards.

For illustration, here is a list of delete commands, grouped from small to big
objects.  Note that for a single character and a whole line the existing vi
movement commands are used.
	"dl"	delete character (alias: "x")		|dl|
	"diw"	delete inner word			*diw*
	"daw"	delete a word				*daw*
	"diW"	delete inner WORD (see |WORD|)		*diW*
	"daW"	delete a WORD (see |WORD|)		*daW*
	"dgn"   delete the next search pattern match    *dgn*
	"dd"	delete one line				|dd|
	"dis"	delete inner sentence			*dis*
	"das"	delete a sentence			*das*
	"dib"	delete inner '(' ')' block		*dib*
	"dab"	delete a '(' ')' block			*dab*
	"dip"	delete inner paragraph			*dip*
	"dap"	delete a paragraph			*dap*
	"diB"	delete inner '{' '}' block		*diB*
	"daB"	delete a '{' '}' block			*daB*

Note the difference between using a movement command and an object.  The
movement command operates from here (cursor position) to where the movement
takes us.  When using an object the whole object is operated upon, no matter
where on the object the cursor is.  For example, compare "dw" and "daw": "dw"
deletes from the cursor position to the start of the next word, "daw" deletes
the word under the cursor and the space after or before it.


Tag blocks						*tag-blocks*

For the "it" and "at" text objects an attempt is done to select blocks between
matching tags for HTML and XML.  But since these are not completely compatible
there are a few restrictions.

The normal method is to select a <tag> until the matching </tag>.  For "at"
the tags are included, for "it" they are excluded.  But when "it" is repeated
the tags will be included (otherwise nothing would change).  Also, "it" used
on a tag block with no contents will select the leading tag.

"<aaa/>" items are skipped.  Case is ignored, also for XML where case does
matter.

In HTML it is possible to have a tag like <br> or <meta ...> without a
matching end tag.  These are ignored.

The text objects are tolerant about mistakes.  Stray end tags are ignored.

==============================================================================
7. Marks					*mark-motions* *E20* *E78*

Jumping to a mark can be done in two ways:
1. With ` (backtick):	  The cursor is positioned at the specified location
			  and the motion is |exclusive|.
2. With ' (single quote): The cursor is positioned on the first non-blank
			  character in the line of the specified location and
			  the motion is linewise.
						*mark-view*
3. Apart from the above if 'jumpoptions' contains "view", they will also try to
restore the mark view. This is the number of lines between the cursor position
and the window topline (first buffer line displayed in the window) when it was
set.

						*m* *mark* *Mark*
m{a-zA-Z}		Set mark {a-zA-Z} at cursor position (does not move
			the cursor, this is not a motion command).

						*m'* *m`*
m'  or  m`		Set the previous context mark.  This can be jumped to
			with the "''" or "``" command (does not move the
			cursor, this is not a motion command).

						*m[* *m]*
m[  or  m]		Set the |'[| or |']| mark.

Title: Vim: Object Selection, Tag Blocks, and Marks
Summary
This section details how object selection works with operators and in Visual mode. It differentiates between using a movement command versus an object, highlighting that an object is operated upon in its entirety regardless of cursor position. It also describes how 'it' and 'at' text objects work when selecting tag blocks in HTML/XML, including how unmatched or self-closing tags are handled. The chapter concludes with an explanation of how to set and use marks (m{a-zA-Z}), providing a way to jump to specific locations within a file using backticks (`) or single quotes (').