We previously learned about text objects, and more specifically about Vim's definitions for words and words. In this section we will learn another way to move horizontally within a buffer, using motions than move the cursor across one or more words.
Command | Action |
---|---|
w | cursor N words forward |
W | cursor N WORDS forward |
e | cursor forward to the end of word N |
E | cursor forward to the end of WORD N |
b | cursor N words backward |
B | cursor N WORDS backward |
ge | go backwards to the end of the previous word |
gE | go backwards to the end of the previous WORD |
Let's first look at how w behaves with the first line of text:
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
Top
1:1
Move the cursor
w
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
Top
1:6
Move the cursor (again)
w
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
Top
1:9
Move the cursor (again)
w
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
Top
1:11
Move the cursor (again)
w
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
Top
1:16
Move the cursor (again)
w
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
Top
1:21
Move the cursor (again)
w
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
Top
1:28
Move the cursor (again)
w
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
Top
1:32
Move the cursor (again)
w
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:1
Now, let's look at how W behaves with the same text:
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
Top
1:1
Move the cursor
W
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
Top
1:6
Move the cursor (again)
W
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
Top
1:9
Move the cursor (again)
W
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
Top
1:11
Move the cursor (again)
w
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
Top
1:16
Move the cursor (again)
w
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
Top
1:21
Move the cursor (again)
w
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
Top
1:28
Move the cursor (again)
W
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:1
w and W behave almost the same for this text. The only difference is the way the trailing period is handled. w stops at the period in step 7, while W steps over the period and proceeds to the next line.
Now, lets look at w with the second line of text:
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:1
Move the cursor (again)
w
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:6
Move the cursor
w
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:11
Move the cursor
w
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:15
Move the cursor
w
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
w
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:26
Move the cursor
w
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:27
Move the cursor
w
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:33
Move the cursor
w
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:36
Move the cursor
w
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:42
Move the cursor
w
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:43
Move the cursor
w
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:47
Move the cursor
w
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:52
Move the cursor
w
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
50%
3:1
And again, with W
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:1
Move the cursor
W
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:6
Move the cursor (again)
W
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:11
Move the cursor
W
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:15
Move the cursor
W
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
W
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:33
Move the cursor
W
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:36
Move the cursor
W
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:42
Move the cursor
W
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:47
Move the cursor
W
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
50%
3:1
The differences between how w and W behave are highlighted in this text.