2

In LaTeX the \ldots command is used to make an ellipsis, so I wanted something like iabbrev ... \ldots that would work in the middle of words, so whatever... would become whatever\ldots.

Any ideas?

dbmrq
  • 857
  • 6
  • 17
  • 7
    A map might work: inoremap ... \ldots. Since one of the main benefits of abbreviations is Vim avoiding middle-of-word expansions, I suppose this qualifies for a map. – muru May 31 '16 at 10:36
  • This question may come in handy. – Jair López May 31 '16 at 13:49
  • 2
    @muru Ah, for some reason a regular inoremap isn't working for me, but now I tried it with vim -u NONE and it works perfectly, so it must be some plugin messing things up. Thanks! And thank you for the link, @jair, if I can't work it out with inoremap I'll go with one of those options. – dbmrq Jun 01 '16 at 06:12
  • Maybe a snippet would be interesting? With ultisnips for example, you can define a snippet active only in latex buffer, when you enter a predefined text (e.g. ld) and press a predefined key the entered text will expand to whatever you want. It requires a little bit of configuration but it is pretty flexible and you can make it expand in the middle of a word. – statox Jun 06 '16 at 07:41

1 Answers1

1

If you really want an abbreviation rather than a mapping, a compromise would be an end-id abbreviation (see :h abbreviations). These end in a keyword character, but the other characters in the abbreviation must be non-keyword characters. These will expand directly after a keyword character. So you could do:

:iabbrev ..s \ldots

Then, typing 'whatever..s ' will be expanded to 'whatever\ldots '

One benefit of this is that ... won't be expanded when you don't want it to be.

Antony
  • 2,570
  • 11
  • 19