Problems installing and using filetype plugins in Vim
I downloaded xml.vim (xmledit : A filetype plugin to help edit XML, HTML, and SGML docum开发者_StackOverflow社区ents ). I placed it in my ftplugins folder. I read the documentation and it says: enter :filetype plugin on
but this doesn't work, I'm still unable to make the filetype plugin work. Any suggestions?
As jefromi suggested in his comment, the :filetype plugin on
shall be done in the .vimrc.
If you enter it manually, the filetype won't be detected on a file already opened, a call to :e
would be necessary in that case to take advantage of the automatic detection mechanism. Otherwise, you'd to specific the filetype manually (with a :set ft=xml
) as described by idimba.
Try
:set ft=xml
Try putting xml.vim
in after/ftplugin/
instead of the default ftplugin folder. This ensures that you override any ftplugin settings that are defined by Vim or the Vim distribution package.
Your first step should be to test that the file is actually loaded using :scriptnames (as Fred mentioned). If it is loaded but still not working you most likely are getting some settings overwritten by other xml.vim files.
You can try putting it in the /after/ftplugin folder, which didn't work for Fred. If that does not work, check the output of :scriptnames and replace the ftplugin/xml.vim files with yours. That did the trick for me. In my case this involved replacing C:\Program Files (x86)\Vim\vim73\ftplugin\xml.vim with the new xml.vim file. Probably a bit of a hack but it fixed it for me.
精彩评论