Word Text Objects

We previously learned about various text objects. In this section we learn how they can help us navigate through our documents.

Editing with the word Text Object

In the first example we demonstrate how to select text using the word text object. In the first case we select a simple word, then we select a word that contains non-alphanumeric characters, which defines the selection boundary.

Initial Conditions
This·is·a·line·with·sample·text.
This·line·has·other·types/kinds·of·words·(and·WORDS)!
 
This·is·a·new·paragraph.·This·is·another·sentence.
And·this·is·another·line.
NORMAL
33%
2:16
 
Move the cursor
viw
This·is·a·line·with·sample·text.
This·line·has·other·types/kinds·of·words·(and·WORDS)!
 
This·is·a·new·paragraph.·This·is·another·sentence.
And·this·is·another·line.
VISUAL
33%
2:19
 
Move the cursor (again)
This·is·a·line·with·sample·text.
This·line·has·other·types/kinds·of·words·(and·WORDS)!
 
This·is·a·new·paragraph.·This·is·another·sentence.
And·this·is·another·line.
NORMAL
33%
2:21
 
Move the cursor (again)
viw
This·is·a·line·with·sample·text.
This·line·has·other·types/kinds·of·words·(and·WORDS)!
 
This·is·a·new·paragraph.·This·is·another·sentence.
And·this·is·another·line.
VISUAL
33%
2:25
 

Editing with the WORD Text Object

In the second example we demonstrate the same steps, but using the WORD text object. Note that the result is very similar to that of the word text object, except the selection boundaries have changed due to the difference in how these two text objects are defined.

Initial Conditions
This·is·a·line·with·sample·text.
This·line·has·other·types/kinds·of·words·(and·WORDS)!
 
This·is·a·new·paragraph.·This·is·another·sentence.
And·this·is·another·line.
NORMAL
33%
2:16
 
Move the cursor
viW
This·is·a·line·with·sample·text.
This·line·has·other·types/kinds·of·words·(and·WORDS)!
 
This·is·a·new·paragraph.·This·is·another·sentence.
And·this·is·another·line.
VISUAL
33%
2:19
 
Move the cursor (again)
This·is·a·line·with·sample·text.
This·line·has·other·types/kinds·of·words·(and·WORDS)!
 
This·is·a·new·paragraph.·This·is·another·sentence.
And·this·is·another·line.
NORMAL
33%
2:21
 
Move the cursor (again)
viW
This·is·a·line·with·sample·text.
This·line·has·other·types/kinds·of·words·(and·WORDS)!
 
This·is·a·new·paragraph.·This·is·another·sentence.
And·this·is·another·line.
VISUAL
33%
2:31