How do I tell what syntax file is being used?

Vim is syntax highlighting my file in a funny way, and I want to know what syntax file is responsible for this behaviour. How do I find out what syntax files vim has loaded?


To find out which files Vim has actually loaded, execute

:scriptnames

The syntax for the current buffer can be queried via

:setlocal syntax?

It usually (but not necessarily) corresponds to the buffer's filetype (:setlocal filetype?).

For a deeper look,

:syntax list

shows all syntax definitions (some syntaxes (can) include other language's syntaxes, e.g. java has html for the JavaDoc comment markup).


You can view what filetype(s) are currently used and by

:verbose set ft ?

The plugin handling the filetype is most likely located at

:e $VIMRUNTIME\ftplugin