Tree-sitter text objects
Brackets and quotes are only the beginning. When Helix knows the language of a file, it parses it with tree-sitter, and match mode gains text objects that describe code rather than characters:
f— a functiont— a type (a struct, enum, class, …)a— an argument or parameterc— a comment
They work exactly like the pairs: mif selects a function’s body, maf
selects the whole function including its signature. The same letters also
move you between objects — ]f selects the next function, [f the previous
one, and the same goes for ]a, [t and the rest.
This sandbox opens every exercise as plain text, so Helix doesn’t know the
buffer is Rust yet. Tell it with a command: type :lang rust and press
Enter. The syntax lights up, and the tree-sitter objects come alive. Helix
normally does this for you from the file extension.
Try it in the editor. Work through the checklist below to move around by function.