I'm running Windows XP pluc Cygwin, maintaining my Vim configuration in
the Cygwin home directory, and sourcing it from Windows.
C:\ :: type "%userprofile%\_vimrc"
set nocompatible
" source $VIMRUNTIME/vimrc_example.vim
" source $VIMRUNTIME/mswin.vim
" behave mswin
" Konfiguration von Cygwin einlesen
source C:\cygwin\home\michael\repos5ak\config\.vimrc
And then, in the Cygwin .vimrc, I prepend the Cygwin .vim directory to
Vim's runtimepath, so that it is searched first:
if has("win32")
set runtimepath=C:/cygwin/home/michael/repos5ak/config/.vim,$VIMRUNTIME
endif
" runtimepath patched, now turn filetypes on
filetype on
This setup works, but not 100%. I have a custom "filetype.vim", and when
running Vim from the Windows environment (as opposed to the Cygwin
environment), this custom file is read after the homonymous file from
the Vim distribution. This matters, because, as documented in "help
new-filetype", section C, there has to be a test in order to prevent
loading the file twice.
type C:\cygwin\home\michael\repos5ak\config\.vim\filetype.vim
if exists("did_load_filetypes")
finish
endif
augroup filetypedetect
autocmd! BufRead,BufNewFile *.pp setfiletype PASCAL
augroup end
The loading order can be seen by entering ":script". On Cygwin:
1: /home/michael/.vimrc
2: /usr/share/vim/vim71/syntax/syntax.vim
3: /usr/share/vim/vim71/syntax/synload.vim
4: /usr/share/vim/vim71/syntax/syncolor.vim
5: /home/michael/repos5ak/config/.vim/filetype.vim # custom first
6: /usr/share/vim/vim71/filetype.vim # system second
7: /usr/share/vim/vim71/ftplugin.vim
8: /usr/share/vim/vim71/indent.vim
9: /home/michael/repos5ak/config/.vim/abbreviations.vim
10: /home/michael/repos5ak/config/.vim/noeol.vim
11: /usr/share/vim/vim71/plugin/getscriptPlugin.vim
[...]
22: /usr/share/vim/vim71/ftplugin/mail.vim
But on Windows, "filetype.vim" is first loaded from the Vim
distribution directory:
1: C:\Dokumente und Einstellungen\michael\_vimrc
2: C:\cygwin\home\michael\repos5ak\config\.vimrc
3: C:\Programme\Vim\vim72\syntax\syntax.vim
4: C:\Programme\Vim\vim72\syntax\synload.vim
5: C:\Programme\Vim\vim72\syntax\syncolor.vim
6: C:\Programme\Vim\vim72\filetype.vim # system
7: C:\cygwin\home\michael\repos5ak\config\.vim\filetype.vim # custom
8: C:\Programme\Vim\vim72\ftplugin.vim
9: C:\Programme\Vim\vim72\indent.vim
10: C:\cygwin\home\michael\repos5ak\config\.vim\abbreviations.vim
11: C:\cygwin\home\michael\repos5ak\config\.vim\noeol.vim
12: C:\Programme\Vim\vim72\plugin\getscriptPlugin.vim
[...]
22: C:\Programme\Vim\vim72\scripts.vim
Prepending the Cygwin directory to the runtimepath as seen above does
not seem to make Vim load the "filetype.vim" before the "filetype.vim"
from the Vim distribution directory. The effect is not different from
appending the directory to the end of the list, like this:
runtimepath+=C:/cygwin/home/michael/repos5ak/config/.vim
How can I make the Windows Vim read the "filetype.vim" from the
Cygwin .vim directory before the "filetype.vim" from the distribution
directory?
Thanks for any pointers.
Michael Ludwig
--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---