Reputation: 8105
When you're using vim, you can move forward word by word with w
. How do I go backwards?
Upvotes: 269
Views: 85232
Reputation: 610
Alternatively, if you use w
, b
, W
, and B
to navigate lines by hopping over words, consider the following alternatives which can be faster if used correctly.
f<char> # jump to next occurrence of <char> to right (inclusive)
or
F<char> # jump back to next occurrence of <char> to left (inclusive)
If your words are separated by <space>
you can hop over words by spaces:
f<space>;;;;
where ;
repeats the previous command, so you hop forward by spaces
F<space>;;
to hop backwards by space
just replace <char>
with punctuation, for example .
The punctuation method is not efficient for scrolling through, but if you know where you want to jump, it can usually get there in a jump or two.
Upvotes: 10
Reputation: 19776
Use b
to go back a word.
You may also want to check out W
and B
to advance/go back a WORD
(which
consists of a sequence of non-blank characters separated with white space, according to :h WORD
).
Upvotes: 357
Reputation: 3361
It helps for me to think of it as:
b
to go to beginning of current or previous word
w
to go the beginning of next word
e
to go to the end of current or next word
ge
to go the end of the previous word
Try :h word-motions
for more details and how to combine them with operations.
Upvotes: 112