Home Explore Blog CI



neovim

6th chunk of `runtime/doc/usr_04.txt`
8f607fe5b51e7a864be14d64b383783ad53e895c50f67a8000000001000008f1
 "dw".  There is a simpler way
to do this: "daw".

	this is some example text. ~
		       daw

	this is some text. ~

The "d" of "daw" is the delete operator.  "aw" is a text object.  Hint: "aw"
stands for "A Word".  Thus "daw" is "Delete A Word".  To be precise, the white
space after the word is also deleted (or the white space before the word if at
the end of the line).

Using text objects is the third way to make changes in Vim.  We already had
operator-motion and Visual mode.  Now we add operator-text object.
   It is very similar to operator-motion, but instead of operating on the text
between the cursor position before and after a movement command, the text
object is used as a whole.  It doesn't matter where in the object the cursor
was.

To change a whole sentence use "cis".  Take this text:

	Hello there.  This ~
	is an example.  Just ~
	some text. ~

Move to the start of the second line, on "is an".  Now use "cis":

	Hello there.    Just ~
	some text. ~

The cursor is in between the blanks in the first line.  Now you type the new
sentence "Another line.":

	Hello there.  Another line.  Just ~
	some text. ~

"cis" consists of the "c" (change) operator and the "is" text object.  This
stands for "Inner Sentence".  There is also the "as" ("A Sentence") object.
The difference is that "as" includes the white space after the sentence and
"is" doesn't.  If you would delete a sentence, you want to delete the white
space at the same time, thus use "das".  If you want to type new text the
white space can remain, thus you use "cis".

You can also use text objects in Visual mode.  It will include the text object
in the Visual selection.  Visual mode continues, thus you can do this several
times.  For example, start Visual mode with "v" and select a sentence with
"as".  Now you can repeat "as" to include more sentences.  Finally you use an
operator to do something with the selected sentences.

You can find a long list of text objects here: |text-objects|.

==============================================================================
*04.9*	Replace mode

The "R" command causes Vim to enter replace mode.  In this mode, each
character you type replaces the one under the cursor.  This continues until
you type <Esc>.
   In this example you start Replace mode

Title: Vim: Text Objects Explained - 'aw', 'cis', and Visual Mode Integration
Summary
This section explains Vim's text objects, focusing on 'aw' (a word) for deletion and 'cis' (inner sentence) for changing. It details how 'daw' deletes a word along with trailing whitespace, while 'cis' replaces a sentence without removing the space. 'as' (a sentence) includes the trailing space. It also illustrates using text objects in Visual mode, allowing for sequential selection and manipulation of text units. Finally, it points to the documentation for a complete list of text objects.