Selecting text objects
Manually selecting a text region is useful for making small, precise edits. But sometimes, we’re interested in the bigger picture. For example, we might want to visually select an entire sentence, paragraph, or block of code.
Visual mode has key maps for this. From any of the visual mode variants, you can use:
- is to expand your visual selection to capture the current sentence
- ip to expand your visual selection to capture the current paragraph
- i" to expand your visual selection to capture the currently quoted string (anything within "")
- i{ to expand your visual selection to capture the current block of code (anything within {})
There are similar mappings for (, [, and so forth, too.
So to immediately select an entire sentence, you can type vis. Or, to immediately select an entire paragraph, it’s vip.
Work through the checklist below, expanding your selection with each text object in turn.