tags:

views:

58

answers:

2

My goal is to highlight <basename>.<extension>.erb files as I would highlight <basename>.<extension> files.

As a first pass, I'm fine with supporting <basename>.<filetype>.erb, which I tried to do with

au BufNewFile,BufRead *.erb setf <afile>:r:e

But this doesn't seem to be working. What should I be doing?

A: 

It seems that the special character expansion is only done when typing command. However you can call the expand function.

 au BufNewFile,BufRead *.erb setf=expand("<afile>:r:e")

Should answer your question (but It doesn't seem to work for what you want to do).

mb14
I'm on my phone now, but maybe set ft=expand('<afile>:r:e') will work
rampion
A: 

Try this:

autocmd BufNewFile,BufRead *.*.erb execute 'doautocmd BufRead ' . expand(':r')

Heptite