# Text object for formulas in Latex

*1,614*pages on

this wiki

In Latex, in-text formulas are surrounded by a pair of `$`

signs. The following plugin plus bindings allow operation on these formulas using the usual syntax for text objects in Vim. This allows for quick yanking, changing and deleting of such formulas which are very common tasks when writing mathematical text in Latex.

For information on operator pending commands and omap see here.

Install CountJump and add the following code to your `ftplugin/tex.vim`

file.

call CountJump#TextObject#MakeWithCountSearch('<buffer>', '$', 'ai', 'v', '\$', '\$')

Now you can yank, delete, etc entire formulas using `i$`

for interior and `a$`

to include the bounding dollar signs.

For example, if you put the cursor inside a formula and type `yi$`

, this will yank the interior of the dollar signs. Typing `da$`

will delete the entire formula including the dollar signs.