joom / latex-unicoder.vim

A plugin to type Unicode chars in Vim, using their LaTeX names.
90 stars 14 forks source link

Replacement of multiple latex codes at once #5

Closed f0rki closed 9 years ago

f0rki commented 9 years ago

The use case is that you might want to write more than one latex code at once, maybe even a small formula, like you would do in a latex math environment. i.e. type \forall \alpha \in A : \exists a \in A : a \cdot \alpha = 1 and then unicode it, either by typing it directly into the prompt or selecting the whole formula in visual mode. Doing it character for character is kind of annoying.

I quickly hacked together the functionality to replace multiple latex codes at once, which seems to work pretty well. It doesn't break auto-completion for the first code, but for all following auto-completion doesn't work anymore.

Note that this was basically my first attempt at vimscript so please excuse any obvious errors.

joom commented 9 years ago

This is something I really wanted to do. Awesome! Thank you very much. :)

joom commented 9 years ago

There is a small issue with this: It fails on codes like _0, _1, ^2, ^3.

f0rki commented 9 years ago

I originally assumed that all latex codes start with a \ . But it's easy to include also _ and ^.

But there is still the problem with the cursive letters. In the version before "a" was replaced by "𝑎" and so on for the other letters. Now they just get ignored. I think it should be configurable, whether you want this replacement or not..