Multiple filetype for snipmate.vim


/ Published in: Other
Save to your folder(s)

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.


Copy this code and paste it in your HTML
  1. au BufRead,BufNewFile *.php set filetype=php.html

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

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.