1

I am usually writing LaTeX documents. I like to use

:iab iso isomorphism

so that if I write a sentence like This map is an iso., it will expand to This map is an isomorphism.. However, I also quite frequently use the command \iso in math mode. So for example, I will write $f \colon V \iso W$ and nothing should be expanded. In other words, the backslash should be counted like a regular character at the beginning of the word, just as aiso would not be expanded.

2

Abbreviations use the iskeyword option. Thus, you can add \ to the list of keyword characters.

set iskeyword+=\

However, this has many side effects which might be unwanted, such changing the meaning of motions like w. An alternative is to use an expression abbreviation which checks whether the iso is prefixed with a \:

inoreabbrev <expr> iso getline('.')[col('.')-5] == '\' ? 'iso' : 'isomorphism'

Thus, \iso will stay as \iso but iso will be expanded to isomorphism.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy