Motion Classification
Char-wise vs line-wise vs block, inclusive vs exclusive.
Every motion has two attributes: shape (char/line/block) and inclusivity (does it include the endpoint?). These attributes change how operators behave.
Every motion in Vim has two characteristics that determine how operators interact with it. Understanding these explains a lot of "surprising" Vim behavior.
Shape: char-wise / line-wise / block-wise
| Motion | Shape |
|---|---|
| h, l, f{c}, t{c}, w, e, b | Char-wise |
| j, k, G, gg, H, L | Line-wise |
| Ctrl-V only | Block-wise |
Char-wise motion + delete = delete a range of characters. Line-wise motion + delete = delete whole lines (even partial coverage). This is why dj deletes two whole lines โ j is line-wise.
Inclusivity: does the motion include the destination character?
| Motion | Inclusive? |
|---|---|
| f{c} | Inclusive (includes the {c}) |
| t{c} | Exclusive (stops before {c}) |
| e, E | Inclusive |
| w, b, W, B | Exclusive |
| $ | Inclusive |
| G, gg | Linewise (inclusivity moot) |
| % | Inclusive |
| Search (/, ?) | Exclusive |
See also: The Vim Grammar