I know how to set up features using
:autocmd for specific file extensions:
augroup xml au BufEnter *.xml call Setup_XML_Menu() au BufLeave *.xml call Destroy_XML_Menu() augroup END
Never mind what
Setup_XML_Menu()does - the point is I'm setting and resetting configuration when I enter or leave an XML buffer.
But is there a way to apply an autocommand for a particular filetype instead?
If I enter a buffer named *.xml, the BufEnter autocmd kicks in as I expect.
But I'd like this to happen when I enter any buffer that has
So if I enter a buffer named server.wsdl (assume I've already arranged for this buffer's filetype to be xml), I'd like the XML autocmd to be applied there too, without configuring autocommands for every conceivable XML file extension.
I hoped I could have something like:
au BufEnter xml call ...
au BufEnter filetype xml call ...
But these don't work (the first example only applies to a buffer named 'xml').
The other possibility I considered:
au FileType xml ... only applies when I explicitly change the filetype of the buffer - I want the settings to be applied and removed when I hop in and out of particular buffer windows.
Am I asking too much?