On 31/12/08 07:48, Matt Wozniski wrote: > 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 could use :filetype off :filetype on after changing your 'runtimepath', which would first unset the filetype-detection autocommands, and then re-source filetype.vim to set them again with the new 'runtimepath' (invoking your ftdetect/*.vim scripts). See ":help :filetype-overview". Or if the reason is that you change 'runtimepath' after invoking ":filetype plugin indent on" or after sourcing vimrc_example.vim, do it before. The location of a possible system-wide vimrc is shown near the middle of the output of the ":version" command. If you compile your own Vim with the vim-default settings, it will look for a system vimrc at /usr/local/share/vim/vimrc, which is almost certainly different of the location (typically /etc/vimrc) used by a Vim version distributed together with a Linux distro. See my compiling HowTo for Unix/Linux at http://users.skynet.be/antoine.mechelynck/vim/compunix.htm Best regards, Tony. -- If A equals success, then the formula is A = X + Y + Z. X is work. Y is play. Z is keep your mouth shut. -- Albert Einstein --~--~---------~--~----~------------~-------~--~----~ You received this message from the "vim_dev" maillist. For more information, visit http://www.vim.org/maillist.php -~----------~----~----~----~------~----~------~--~---