7

According to latex-suite documentation, `. should expand into \cdot but this is not working for me. All other abbreviations (greek letters and math) do work. I tried looking in ~/.vim/ftplugin/main.vim and it seems to look fine:

call IMAP (g:Tex_Leader.'.', '\cdot', "tex")

or at least it is identical to the other ` abbreviations setup. I looked in wizardfuncs.vim, mathmacros.vim and mathmacros-utf.vim (all in the ~/.vim/ftplugin/ path), since I do not know which file vim actually reads, and there are the lines:

\."\n `.     \\cdot             `*     \\times"

exe s:pA8.'cdot<Tab>`.              <plug>\

exe s:pA8.'cdot<Tab>`.\ \ ⋅              <plug>\cdot '

respectively, which are no different from other abbreviations format. Even putting manually

call IMAP('`.', '\\cdot', 'tex')

in ~/.vimrc doesn't manage to resolve.

I know it's not that big an issue, but I was getting sort of curious as to why `. is unmanageable...

  • Seems like a bug. It doesn't work for me either. – Henri Menke Feb 3 '14 at 15:47
  • Idem: it doesn't work for me either. – Immanuel Weihnachten Feb 28 '14 at 17:41
2

This is a conflict with the smart dots key mapping that automatically replaces ... with \cdots, \ldots or \dots as appropriate. If you disable this feature by adding

let g:Tex_SmartKeyDot=0

to $VIMFILES/ftplugin/tex.vim, then the key mapping works as intended.

This happens because of the way that the SmartDots() function is implemented: vim-latex watches for any . inserted and, if there are only 1 or 2 consecutive dots, the function returns . or .., respectively. When it sees three consecutive dots, it inserts the appropriate 'dots' macro. This seems to override any of the IMAP mappings because the last . was not inserted by the user, but was instead returned by the function. You can also test this by adding a mapping such as

call IMAP('TEST.', 'test', 'tex')

which does not work whenever smart dots is enabled.

If you use either the amsmath or ellipsis package, then \dots is all you will need. To use the ``.` key mapping, you can simply add

let g:Tex_SmartKeyDot=0
call IMAP('...', '\dots', 'tex')

to $VIMFILES/ftplugin/tex.vim.

Your Answer

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

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