Wikia

Vim Tips Wiki

Text object for formulas in Latex

Talk0
1,610pages on
this wiki
Revision as of 06:43, July 13, 2012 by JohnBot (Talk | contribs)

Tip 1644 Printable Monobook Previous Next

created January 16, 2010 · complexity basic · version 7.0


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 {{script|id=3130|text=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.

Comments

Advertisement | Your ad here

Around Wikia's network

Random Wiki