Posted By

studiomohawk on 09/29/10


Tagged

vim


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

scottshane


Multiple filetype for snipmate.vim


 / Published in: Other
 

URL: http://dancingpenguinsoflight.com/2009/07/light-at-the-end-of-the-carpal-tunnel-snippets-in-vim-with-snipmate/

One issue I ran into early on was wanting more than one filetype’s snippets available for a single file. In my case, I was editing a file with a .php extension, but it had a lot of HTML in it as well. Since the filetype is determined from the extension, I only had the snippets for PHP. To fix this, I added a file ~/.vim/ftdetect/php.vim, containing:\r\n\r\nWhen a file with an extension matching a filename in ftdetect is opened, its filetype can be changed to whatever is desired via a directive like the one above. The dot separating the filetypes allows for multiple formats to be made available at once.

  1. au BufRead,BufNewFile *.php set filetype=php.html

Report this snippet  

You need to login to post a comment.