Mission 40 / 52• Text Objects - Words

Change Inside Word

Unlike `cw` (which only changes from the cursor to the end of the word), `ciw` changes the *whole* word regardless of where cursor is situated.

Change inside word

  • ciwchange the entire word under cursor and enter insert mode
  • cawchange word and its adjacent space
1
function calculateSubtotal(items) {
2
return items.length;
3
}

Place your cursor on `Subtotal`, press `ciw`, type `Total`, and press `esc`. The entire identifier was replaced seamlessly.

Now it's your turn!

0 / 4 tasks complete0.0s / 27s par0 / 47 par

Practice this lesson's commands. Each task checks your technique and the result, not just your cursor position. Take your time.

Task 1: Rename fetchOld to fetchNew with ciw. Return to normal mode.

Expected result
function fetchNew() {}
Show hint

Use ciw, type fetchNew, then Escape.

1
function fetchOld() {}
jkscroll•ggGtop/bottom•Tabnext example•Enterstart•qstop•Ctrl+kCtrl+jprev/next