In your vimrc:
autocmd BufRead,BufNewFile *.scss.erb setlocal filetype=scss.eruby
(see :help ftdetect
, section 2).
EDIT
To set the file type for four extensions, this works for me:
autocmd BufRead,BufNewFile *.*.* \ sil exe "setlocal filetype=" . substitute(expand("%"),"^[^.]*\.","",1)
The substitute
command builds the file type by simply removing all text from the file name before the first .
. Could be a more complicated way ...
CHANGE AGAIN
Here is another try. MultiExtensionFiletype()
is a function that uses the default file type for the last part of the extension and prefixes it with the first part of the extension (i.e. the part placed between the dots).
function MultiExtensionFiletype() let ft_default=&filetype let ft_prefix=substitute(matchstr(expand('%'),'\..\+\.'),'\.','','g') sil exe "set filetype=" . ft_prefix . "." . ft_default endfunction
The function must be called in the BufReadPost
event, so the original file type is set by ignoring multiple extensions.
autocmd BufReadPost *.*.* call MultiExtensionFiletype()
Hope this answer comes down to something useful!
source share