Benjamin R. Haskell wrote:
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).

The most recent syntax/tex.vim has: (available at http://mysite.verizon.net/astronaut/vim/index.html#vimlinks_syntax as tex.vim.gz)

" (La)TeX keywords: uses the characters 0-9,a-z,A-Z,192-255 only... {{{1
" but _ is the only one that causes problems.
" One may override this iskeyword setting by providing
" g:tex_isk
if exists("g:tex_isk")
 exe "setlocal isk=".g:tex_isk
else
 setlocal isk=48-57,a-z,A-Z,192-255
endif
if b:tex_stylish
  setlocal isk+=@-@
endif

Consequently one may force syntax/tex.vim to have whatever characters in iskeyword you wish via g:tex_isk .

Regards,
Chip Campbell

--
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