juvenn / mustache.vim

Vim mode for mustache and handlebars (Deprecated)
github.com/mustache/vim-mode
125 stars 14 forks source link

ftdetect not working? #2

Closed greg0ire closed 12 years ago

greg0ire commented 12 years ago

I installed your plugin via pathogen, and I can't have syntax highlighting in a .handlebars file unless I explicitely set the filetype (like this :setfiletype mustache). I saw a condition in the file : if has("autocmd"), so I typed :autocmd and saw it was installed, obviously, so the condition should pass.

nono commented 12 years ago

For your information, I've made a fork of mustache.vim specifically for Handlebars: https://github.com/nono/vim-handlebars

greg0ire commented 12 years ago

I just installed it via pathogen too and it works great... but I must type :setfiletype handlebars... I guess something must be missing in my vim configuration, but what?

juvenn commented 12 years ago

It does support .handlebars. Could you confirm this in ftdetect/mustache.vim?

if has("autocmd")
  au  BufNewFile,BufRead *.mustache,*.handlebars,*.hbs set filetype=mustache
endif

If a .mustache works, then .handlebars should work as well.

greg0ire commented 12 years ago

The fact is, it doesn't work for .mustache either, the detected filetype is html... I was mislead because html gives some coloration, but after setting the filetype to mustache, it is far better. My vim configuration is available here if you want to take a look at it.

juvenn commented 12 years ago

Hi greg, sorry for late reply.

Your configuration is right as I can see. It should detect *.mustache, *.handlebars, *.hbs, as you can see in ftdetect/mustache.vim:

au  BufNewFile,BufRead *.mustache,*.handlebars,*.hbs set filetype=mustache

Can you try a new file with *.hbs extension?

greg0ire commented 12 years ago

Hello juvenn, thanks for the reply, I tried with a hbs copy of the handlebars file, and I got the same problem. I posted my problem here and got a solution using a filetype.vim file... strange.

greg0ire commented 12 years ago

My use of pathogen was in cause. Sorry for the inconvenience. I posted the solution [here](http://unix.stackexchange.com/questions/21843/filetype-not-detected

juvenn commented 12 years ago

That's great you've got it working, thanks :)