I am using vim 8.1. When I need to change the default filetype for .s
extension to gas
(which by default is asm
), I first look for the default command to set filetype in /usr/share/vim/vim81/filetype.vim
. It contains this line:
au BufNewFile,BufRead *.asm,*.[sS],*.[aA],*.mac,*.lst call dist#ft#FTasm()
Then, I tried to overwrite that in my vimrc
with this:
autocmd BufNewFile,BufRead *.s setfiletype gas
But, it doesn't work. Filetype still asm
when I open any *.s
file.
Then, when I use this:
autocmd BufNewFile,BufRead *.s set ft=gas
It works.
So, what is the difference between set ft=<filetype>
and setfiletype <filetype>
?
setfiletype=gas
is not even a valid syntax, it would besetfiletype gas