Textobjects
Selecting and manipulating text with textobjects
Textobjects select a whole word, paragraph, function, or other piece of text
without counting characters or moving to its start. Select the object, check
the highlighted text, then apply an action such as c, d, or y.
Try Edit code with textobjects for
exercises with words, quotes, function navigation, and scoped changes.

ma- Select around the object (vain Vim,<alt-a>in Kakoune)mi- Select inside the object (viin Vim,<alt-i>in Kakoune)
Key after mi or ma | Textobject selected |
|---|---|
w | Word |
W | WORD |
p | Paragraph |
(, [, ', etc. | Specified surround pairs |
m | The closest surround pair |
f | Function |
t | Type (or Class) |
a | Argument/parameter |
c | Comment |
T | Test |
e | Data structure entry |
g | Change |
s | Spelling finding |
x | (X)HTML element |
Function, type, argument, comment, test, entry, and element objects require syntax support for the language. Check the textobjects column in Language support.
The s textobject uses spell-checking findings. Both
mis and mas select the diagnosed word under the cursor; mIs and mAs
select every finding fully contained in the current selection. Use [s and
]s to navigate to the previous or next finding. These commands also work in
plain text and scratch buffers when spell checking is enabled.
Select all objects in a region
Use mI for every inside object or mA for every around object fully contained
in the current selections. For example, press %, then mIf to select the
inside of every function in the buffer. Apply y, c, or another action to
all of them at once.
Select-all supports words, paragraphs, the syntax objects above, Git changes,
and spelling findings. mId and mAd select diagnostic ranges. Surround pairs
are selected individually with mi and ma.
Navigating using tree-sitter textobjects
Navigating between functions, classes, parameters, and other elements is
possible using tree-sitter and textobject queries. For
example to move to the next function use ]f, to move to previous
type use [t, and so on.

For the full reference see the unimpaired section of the key bind documentation.
💡 This feature relies on tree-sitter textobjects and requires the corresponding query file to work properly.