6

In the default filetype.vim that comes with MacVim, I have the following:

au BufNewFile,BufRead *.erb,*.rhtml setf eruby

I installed MacVim using Homebrew, and I've installed Janus. Following the instructions from Janus, I've created ~/.vimrc.local to store my local customizations. I want to set the filetype for *.html.erb files to html.eruby.eruby-rails, so I added the following line to ~/.vimrc.local.

autocmd BufNewFile,BufRead *.html.erb setf html.eruby.eruby-rails

However, it appears that the filetype is still being selected by MacVim's default filetype.vim instead of picking up my change in ~/.vimrc.local.

What do I need to do differently, so as to have MacVim properly designate *.html.erb files as filetype html.eruby.eruby-rails without modifying the default filetype.vim?

4

2 回答 2

8

setf将您的 autocmd更改为set ft=. 如果你看一下:help setf它说如果它已经在别处设置它不会设置文件类型。

于 2011-02-23T15:19:38.663 回答
1

Well, I tried the following and it seems to work:

autocmd FileType eruby set ft=html.eruby.eruby-rails

However, if I understand correctly, this is changing all files that the default filetype.vim designates as eruby to a filetype of html.eruby.eruby-rails.

于 2011-02-23T14:29:40.957 回答