3

I have these abbreviations in my .vimrc:

iab seq sequent
iab seqs sequents

seqs expands to

sequents
i seq sequent

in a tex file (I have installed vim-latex). In an empty buffer seqs expands correctly to sequents. How could I get the correct expansion in a tex file?

EDIT:

I addition, abbreviations are not expanding at all in a line of a tex buffer, if, e. g., left movements of cursor were made in that line.

I've noticed that all abbreviations work correct in a .tex buffer if triggered with Tab or CR. One simple way out is

imap <f2> <Tab><BS> 
" One space after <BS> in f2
imap <f3> <Tab><BS>

and trigger abbreviations with f2 or f3. Please let me know if you find ` better solution.

7
  • 2
    Not sure if this is enough... but maybe try using :inoreabbrev instead? It doesn't do recursive expansions of the rhs, which is what might be triggering unwanted behavior when combined with vim-latex...
    – filbranden
    Sep 3 '18 at 21:39
  • @FilipeBrandenburger want to write an answer?
    – D. Ben Knoble
    Sep 4 '18 at 3:59
  • I think we're still missing one piece, which is what in vim-latex is causing the abbreviation to misbehave... I'll see if I can reproduce that somewhere and debug a bit more...
    – filbranden
    Sep 4 '18 at 4:13
  • inoreabbrev works in the same way as iab in my example: seqs expands to the same text. The Abolish plugin adds an additional asterisk. seq expands to * sequent in a tex buffer (and I even didn't try seqs). I think that vim-latex is buggy for abbreviations
    – Romas
    Sep 4 '18 at 4:27
  • Sorry, inoreabbrev also adds the additional asterisk. So the additional Abolish asterisk comes from inoreabbrev, I think
    – Romas
    Sep 4 '18 at 4:52
2

So this is a bug of vim-latex v1.9.0 that is fixed in v1.10.0.

I finally managed to reproduce the issue you reported and after using git bisect on the vim-latex sources, I managed to narrow it down to commit ba140b1bd2d8 which fixes this issue.

(I didn't see a bug report or a pull request for that commit, so not really sure whether it was meant to fix a bug, or just using a better API and ended up fixing the bug as a side effect.)

My suggestion is that you should upgrade to v1.10.0, but applying that patch to v1.9.0 seems to work as well (if for some reason you prefer to cherry-pick a single fix.)

4
  • Thank you very much! I cannot install vim-latex v1.10.0. Fedora's dnf has only v1.9.0. When I do dnf remove vim-latex and manually extract v1.10.0 in ~/.vim, (according to vim-latex.sourceforge.net/… then vim doesn't read files in the extracted directory ~/.vim/vim-latex-1.10.0 Latex-suite commands are not working and :scriptnames doesn't list the files in the directory ? How could I get vim read the directory when launched?
    – Romas
    Sep 5 '18 at 9:30
  • 1
    @Romas You can find vim-latex 1.10.0 for Fedora 29 here, download the vim-latex-1.10.0-1.fc29.noarch.rpm file from there and install it on your system with dnf or rpm -Uvh vim-latex-*.rpm. That might be the simplest approach.
    – filbranden
    Sep 5 '18 at 16:59
  • 1
    @Romas The reason why your unpacking into ~/.vim didn't work is that you're not expected to have a vim-latex-1.10.0 directory there, but instead you're expected to have the contents of that directory there, so you'll have ~/.vim/plugin/..., ~/.vim/ftplugin/..., etc. That, of course, is a problem if you already have a ~/.vim with stuff in it... You could merge the contents, but that's too much hassle... A better approach is to use a plug-in manager, such as vim-plug, in which case you can load it with Plug 'vim-latex/vim-latex'.
    – filbranden
    Sep 5 '18 at 17:03
  • @Romas If this indeed fixes the issue you reported, please mark this answer as such (by clicking the check mark on it.) I see you reported a follow up problem, I'll take a look at it now. Cheers! Filipe
    – filbranden
    Sep 6 '18 at 20:50

Not the answer you're looking for? Browse other questions tagged or ask your own question.