Moving by Words

Words are the building blocks of every program. They conveniently create natural targets for navigation. Take this line of code for example:




1
2
3
4
5
6
7
8
9
const test = document.getElementById("test");

Think of the 9 words in this line of code as stepping stones in a platformer game — each one is a target you can jump to.

w
-move to the next word
Example
e
-move to the end of a word
Example
b
-move back a word
Example







function setGreeting(greeting: string) {
const element = document.getElementById('greeting');
element.innerText = greeting;
}
setGreeting('Hello World!');
 0/15  00:00

What defines a word?

In Vim, a word consists of a sequence of letters, digits and underscores separated with white space:




1
2
3
4
test one test1234 snake_case_is_cool

Words are also formed when switching between the characters defined above and special symbols - Vim treats each group as a separate word:




1
2
3
4
5
6
7
8
9
10
alphanumeric#$%#@! Alice-->Bob test@gmail.com