vim shortcut to replace char under cursor with an expression?
I'm processing an old text into latex.
All I have is an old pdf file, which I copy-paste bit by bit, replacing the ill-copied bits to fit latex code. The text contains a lot of inline math, and features a lot of different variables. Every variable is explained in-text and is thus named inline:
Zie figuur 3, waar R de weerstand voorstelt
What I do now is this:
- go to the relevant line
- in normal mode type f+R (where
R
is the char I need to chan开发者_开发百科ge) - i
- type
\(
before the char - type
\)
after the char
voila, the char is now recognized by latex as a math char.
I would like to now if there isn't a quicker procedure that replaces steps 3 to 5?
Record a macro. For example, if you want to save it in register a do the following:
fRqai\(<esc>la\)<esc>q
Now, once you're over the character you want, use @a
. To repeat the last macro you can also use @@
. So, an example of redoing it:
fR@a
精彩评论