views:

220

answers:

1

When I am working on a PHP file for example the default filetype is php. This makes sense, however when that PHP file has HTML as well the filetype is still only php. For some plugins that means that I get the PHP functionality for that plugin, but miss out on the HTML functionality. A more specific situation where this happens is with my snippet plugin. I get php snippets and not html snippets when I am editing a php file.

Possible solutions to this (which I obviously don't like, hence my posting this question) are:

  1. add a map to toggle between different filetypes when I am editing different sections of the file.
  2. update my php snippets file to include the html snippets as well (while this would work for the example above, it doesn't solve the fundamental problem).

So, Is there a way to edit a file using multiple filetypes at the same time in vim?

Edit: For future reference the specific plugin that I am talking about is called snipMate. http://www.vim.org/scripts/script.php?script_id=2540

+3  A: 

You can specify to use multiple filetypes at the same time. For example:

:setfiletype html.php

But most of filetype plugings and syntax files are not designed for such cases. See also :help 'filetype'

Kana Natsuno
Perfect! For the plugin I was mainly concerned about, this worked perfectly. Editing a PHP file I type :setfiletype html.php.js.css and the snippet plugin includes the snippet files for all of the filetypes specified.Thanks
chadgh

related questions