开发者

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:

  1. go to the relevant line
  2. in normal mode type f+R (where R is the char I need to chan开发者_开发百科ge)
  3. i
  4. type \( before the char
  5. 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
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜