On Tue, Dec 30, 2008 at 1:14 PM, Daniel Schierbeck wrote: > > I have added several directories to my runtimepath, each corresponding > to a git repository. For example, I have a directory ~/Projects/vim- > rack that contains ftdetect/rack.vim and syntax/rack.vim. I'm able to > manually :set filetype=rack (i.e. the syntax/rack.vim file is picked > up), but the ftdetect file does not work. It works fine if I create a > symlink at ~/.vim/ftdetect/rack.vim. > > It seems there's a bug in the way ftdetect files are sourced. This > feeling is amplified by the fact that I can insert syntax errors into > ~/Projects/vim-rack/ftdetect/rack.vim without Vim complaining on > startup. > > > I hope there's a simple workaround.
Sorry I couldn't come up with the solution earlier on IRC, but after some sleep, I think I see what's going wrong here. 10 to 1 says you're using a 'nix distro that installs a default system-wide vimrc, and that system-wide vimrc does 'filetype on', meaning that $VIMRUNTIME/filetype.vim gets loaded before your ~/.vimrc ever adds your runtimepaths onto the default runtimepath, and only the ftdetect directories in the default runtimepath are used. I'm not really sure what to do about that, though. You could remove the system-wide vimrc entirely, and move anything done in it to your ~/.vimrc after your change to runtimepath... but this seems ugly as it affects other users. You could alias vim="vim --cmd 'set rtp^=yourdir'" in your shell rc, but that also seems horrifically ugly. You could redo the "runtime! ftdetect/*.vim", but that would make any autocmds from *other* directories in the runtimepath be re-added... I think the nicest thing to do would be to save the existing value of the 'runtimepath' option, overwrite it with *just* the directories you want added, do the "runtime! ftdetect/*.vim", reset 'runtimepath' back to its old value, and then add the new paths to that option in the right spots... but that seems like a whole lot of work for this. Anyone see any better solutions? It's a shame there are no autocmds for an option being set... ~Matt --~--~---------~--~----~------------~-------~--~----~ You received this message from the "vim_dev" maillist. For more information, visit http://www.vim.org/maillist.php -~----------~----~----~----~------~----~------~--~---
