What is the difference between filetype= and syntax= in Vim? -


i noticed in order vim color highlight syntax of specific file, 1 can both set following in _vimrc file:

au bufnewfile,bufread *.file_extension set filetype=program_highlighting  au bufnewfile,bufread *.file_extension set syntax=program_highlighting 

what difference between using filetype= or syntax=?

the 'filetype' superset of 'syntax'.

with 'filetype' (assuming have :filetype plugin on configured), load filetype plugins , corresponding settings (e.g. indent config, compiler, mappings) ftplugin configuration subdir, in addition setting syntax filetype name.

that last part done automatically vim part of filetype processing, in $vimruntime/syntax/syntax.vim:

au! filetype *  exe "set syntax=" . expand("<amatch>") 

Comments

Popular posts from this blog

matlab - "Contour not rendered for non-finite ZData" -

delphi - Indy UDP Read Contents of Adata -

javascript - Any ideas when Firefox is likely to implement lengthAdjust and textLength? -