Am 25.09.2010 21:42, schrieb ZyX:
Consider the following command:

vim -u NONE --cmd 'set nocompatible' \
             --cmd 'au SourcePre *  echom "Sourcing ".expand("<afile>")' \
             -c 'syntax on' \
             -c 'set ft=vim' \
             -c 'redir!>  messages' \
             -c 'messages' \
             -c 'scriptnames' \
             -c 'redir END'

You will get the following in messages:
===== messages =====
Перевод сообщений на русский язык: Василий Рагозин<[email protected]>
Sourcing /usr/share/vim/vim73/syntax/syntax.vim
Sourcing /usr/share/vim/vim73/syntax/synload.vim
Sourcing /usr/share/vim/vim73/syntax/syncolor.vim
Sourcing /usr/share/vim/vim73/filetype.vim
Sourcing /usr/share/vim/vimfiles/ftdetect/asciidoc_filetype.vim
<Skipping lots of ftdetect>
Sourcing /usr/share/vim/vimfiles/ftdetect/xquery.vim
   1: /usr/share/vim/vim73/syntax/syntax.vim
   2: /usr/share/vim/vim73/syntax/synload.vim
   3: /usr/share/vim/vim73/syntax/syncolor.vim
   4: /usr/share/vim/vim73/filetype.vim
   5: /usr/share/vim/vimfiles/ftdetect/asciidoc_filetype.vim
<Skipping lots of ftdetect>
  26: /usr/share/vim/vimfiles/ftdetect/xquery.vim
  27: /usr/share/vim/vim73/scripts.vim
  28: /usr/share/vim/vim73/syntax/vim.vim
  29: /usr/share/vim/vim73/syntax/perl.vim
  30: /usr/share/vim/vim73/syntax/ruby.vim
  31: /usr/share/vim/vim73/syntax/python.vim
====================
while expected:
===== messages =====
Перевод сообщений на русский язык: Василий Рагозин<[email protected]>
Sourcing /usr/share/vim/vim73/syntax/syntax.vim
Sourcing /usr/share/vim/vim73/syntax/synload.vim
Sourcing /usr/share/vim/vim73/syntax/syncolor.vim
Sourcing /usr/share/vim/vim73/filetype.vim
Sourcing /usr/share/vim/vimfiles/ftdetect/asciidoc_filetype.vim
<Skipping lots of ftdetect>
Sourcing /usr/share/vim/vimfiles/ftdetect/xquery.vim
Sourcing /usr/share/vim/vim73/syntax/vim.vim
Sourcing /usr/share/vim/vim73/syntax/perl.vim
Sourcing /usr/share/vim/vim73/syntax/ruby.vim
Sourcing /usr/share/vim/vim73/syntax/python.vim

   1: /usr/share/vim/vim73/syntax/syntax.vim
   2: /usr/share/vim/vim73/syntax/synload.vim
   3: /usr/share/vim/vim73/syntax/syncolor.vim
   4: /usr/share/vim/vim73/filetype.vim
   5: /usr/share/vim/vimfiles/ftdetect/asciidoc_filetype.vim
<Skipping lots of ftdetect>
  26: /usr/share/vim/vimfiles/ftdetect/xquery.vim
  27: /usr/share/vim/vim73/scripts.vim
  28: /usr/share/vim/vim73/syntax/vim.vim
  29: /usr/share/vim/vim73/syntax/perl.vim
  30: /usr/share/vim/vim73/syntax/ruby.vim
  31: /usr/share/vim/vim73/syntax/python.vim
====================

The most strange here is that if you change SourcePre to SourceCmd, you will get
the same output in messages, but nothing will be sourced. If you prepend to
SourceCmd `` | execute "source ".expand('<afile>')'' you will still have the
same stuff in messages, but all files will be sourced (and the most strange that
I cannot get the last version work without removing ``-u NONE''). Can someone
explain this weird behavior? I can see it on vim-7.2.303 (mercurial), vim-7.3
(Gentoo repositories) and vim-7.3 revision d0049ff5969e --with-features=huge.

Filetype plugins are sourced (actually :runtime'd) from
    au FileType * call s:LoadFTPlugin()

I think the "problem" is the SourcePre autocmd being nested within another autocommand. (:h autocmd-nested)

--
Andy

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