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?

4 Answers 4


To find out which files Vim has actually loaded, execute

  • That's useful. Now, here is something I'm not sure about: if a syntax file shows up in this list, is it guaranteed that the syntax file is "active"? I can see quite a few syntax files here. Dec 10, 2013 at 10:04
  • 12
    Generally, only the last one listed is "active", and even it may not be if you've turned syntax highlighting off. To see the syntax currently in effect, execute :echo b:current_syntax. To see the syntax items currently in effect, do as Ingo suggested and execute :syntax list. The latter may help if syntax items from more than one syntax file are in effect, as Ingo noted.
    – garyjohn
    Dec 10, 2013 at 15:07
  • 1
    On Mac OS X I modified the /usr/share/vim/vim73/filetype.vim. After using the above command I realized it was using MacVim's version at ~/Applications/MacVim.app/Contents/Resources/vim/runtime/filetype.vim. If you have MacVim installed, make sure you modify the correct file.
    – echamber
    Jan 18, 2015 at 19:26
  • 3
    You may have two syntax files loaded that have the same name. For example, vim ships with syntax highlighting for ColdFusion, (/usr/share/vim/vim81/syntax/cf.vim for me). I installed a custom cf.vim because the standard one is dated. :scriptnames shows both files. The default is lower on the script list; however, the former is being used. If you look at /usr/share/vim/vim81/syntax/cf.vim, there's a guard if exists("b:current_syntax") finish endif. So, in my case, the scriptnames was helpful, but I had to dig a bit deeper.
    – benbotto
    Jun 5, 2018 at 16:38

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).

  • 4
    This is what I came looking for based on the title of OP's question. OP of course clarifies in the description he's looking for the actual syntax file, but I appreciate you leaving this here since it's one of the first answers in search engines.
    – verboze
    May 6, 2019 at 15:44

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

I guess you would like to know exactly which highlighting color scheme(syntax) is currently being used for the file opened, here is what I do:

as @garyjohn mentioned


But this will show you a complete list of settings currently loaded.

  1: /usr/share/vim/vimrc
  2: ~/.vimrc
  3: /usr/share/vim/vim81/syntax/syntax.vim
  4: /usr/share/vim/vim81/syntax/synload.vim
  5: /usr/share/vim/vim81/syntax/syncolor.vim
  6: /usr/share/vim/vim81/filetype.vim
  7: /usr/share/vim/vim81/plugin/getscriptPlugin.vim
  8: /usr/share/vim/vim81/plugin/gzip.vim
  9: /usr/share/vim/vim81/plugin/logiPat.vim
 10: /usr/share/vim/vim81/plugin/manpager.vim
 11: /usr/share/vim/vim81/plugin/matchparen.vim
 12: /usr/share/vim/vim81/plugin/netrwPlugin.vim
 13: /usr/share/vim/vim81/plugin/rrhelper.vim
 14: /usr/share/vim/vim81/plugin/spellfile.vim
 15: /usr/share/vim/vim81/plugin/tarPlugin.vim
 16: /usr/share/vim/vim81/plugin/tohtml.vim
 17: /usr/share/vim/vim81/plugin/vimballPlugin.vim
 18: /usr/share/vim/vim81/plugin/zipPlugin.vim
 19: ~/.vim/syntax/applescript.vim

Then which exactly is the one doing coloring? => the last one always the decision maker(e.g.):


In my case, I want to test last downloaded syntax of applescript.vim if working.

On the other side, please be reminded that vim syntax is filetype/extension-based, so check exactly the file definition at /usr/share/vim/vim81/filetype.vim, there you can easily find out AppleScript has its unique extension defined as .scpt (as standard) .

Hope this helps also.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.