On Tue, 29 Mar 2011, Pavol Juhas wrote:

Hello,

I found a strange behavior in vim 7.3.146 when adding insert-mode abbreviations with the tex syntax loaded. Given a test.tex file that contains just one line

\begin{article}

The following command gives error "E474: Invalid argument":

   vim -N -i NONE -u NONE -c "syntax on" -c "iabbrev 0foo bar" test.tex

The result is the same if the "syntax on" and "iabbrev 0foo bar"
commands are typed within the vim session. Somehow vim does not like any abbreviations that start with a digit. Strangely, if I delete the leading backslash and change the text to "begin{article}", everything works fine and the "0foo" abbreviation gets correctly defined. There is no such issue in the unpatched vim 7.3.

Can somebody take a look at this?  Thank you,

The 'isk' ('iskeyword') setting w.r.t. TeX files appears to have changed relatively recently. In Vim 7.2.something:

grep -r isk /usr/share/vim/vim72/syntax/tex.vim
  set isk-=_
    set isk+=@
  setlocal isk-=_
    setlocal isk+=@

But in hg:

grep -r isk runtime/syntax/tex.vim
  set isk=a-z,A-Z
    set isk+=@
  setlocal isk=a-z,A-Z
    setlocal isk+=@

So, assuming you use the default 'isk' setting, digits are no longer included. Whether a character is a keyword character affects abbreviations in a slightly-complex way (see full explanation at :help Abbreviations).

--
Best,
Ben

--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Raspunde prin e-mail lui