vim default syntax for files with no extension

vim

Solution

One way would be to add an autocommand to your `.vimrc` for files that don't have the syntax set:

au BufNewFile,BufRead * if &syntax == '' | set syntax=html | endif

Or, you could set the filetype for any file that it's not defined for:

filetype plugin on
au BufNewFile,BufRead * if &ft == '' | set ft=html | endif

Setting `filetype plugin on` along with the `au` command gives the added benefit of loading HTML plugins if you have any. This also sets the syntax to "html" as well.

Problem

How do I set up a default syntax for files that have no extension in vim?

Original source