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.
signature.asc
Description: This is a digitally signed message part.
