Making Small Edits

In this lesson, you will learn how to make small edits to your text using the s, x, and r operators.

x
-delete the character under the cursor
Example
s
-delete the character under your cursor and enter insert mode.
Example
r
-replace the character under your cursor with the next character you type
Example




const foo = findOldestUser(users);
const bar = findYoungestUser(users);
console.log(oldestUser, youngestUser);
 0/15  00:00

When to use r vs s

The r operator is useful when you want to replace a single character with another character. It's a nice way to quickly correct a typo without leaving normal mode.

The s operator is useful when you want to replace a single character with multiple characters via insert mode.