wyc
wyc

Reputation: 55263

Problems installing and using filetype plugins in Vim

I downloaded xml.vim (xmledit : A filetype plugin to help edit XML, HTML, and SGML documents ). 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?

Upvotes: 2

Views: 1035

Answers (4)

Fonnae
Fonnae

Reputation: 523

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.

Upvotes: 0

Luc Hermitte
Luc Hermitte

Reputation: 32926

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.

Upvotes: 2

Ton van den Heuvel
Ton van den Heuvel

Reputation: 10528

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.

Upvotes: 0

dimba
dimba

Reputation: 27571

Try

:set ft=xml

Upvotes: 0

Related Questions