I have installed a lot of plugins and each may has its own ftplugin settings. What is the way to find out all ftplugin scripts that have been sourced for the current buffer?

Just to summarize the solution based on the accepted answer:

:exe 'filter #ftplugin/' . &filetype . '.vim$# scriptnames'
  • 1
    Actually, it's little bit more complex than that. For instance, in C++, C ftplugins will also get loaded. Somehow, @Jim's answer took that into account, but also returned autoloaded plugins. Oct 11, 2017 at 17:12
  • 1
    Also, if you work in C and on CSS, the command will also keep ftplugin/css.vim for instance. It depends on whether false positive are acceptable or not. Oct 11, 2017 at 17:19
  • @Luc Hermitte, you are completely right. So the question is still open. Is there a way to withdraw the acceptance?
    – doraemon
    Oct 12, 2017 at 6:34
  • @LucHermitte, I modified the answer so that your second concern is solved. The first one I have no idea and is still waiting for some experts to solve
    – doraemon
    Oct 13, 2017 at 1:12

2 Answers 2


I don't know of a direct way to get a list of only the things loaded for the current buffer based on filetype, but :scriptnames will list everything that's been loaded, including system/default plugins, runtime scripts, etc.

To figure out what's additionally autoloaded for a specific filetype, start Vim with no arguments, run :scriptnames, then open a file of the type you care about, and run :scriptnames again. If anything new was autoloaded for the filetype, you'll see it appended to the list the second time.

You can capture the output (to paste into a buffer, for example) with redir:

:redir @a
:redir END

You'll see the output displayed, but it will also be copied to register a. You can paste that into a buffer with "ap.

  • 2
    Thanks @Jim Stewart. Based on your answer, I fount the solution: :exe 'filter #ftplugin/' . &filetype . '# scriptnames'.
    – doraemon
    Oct 11, 2017 at 4:51

A manual way might be to use script debugging. Edit a file with the :debug command, say :debug e foo.c. Then set breakpoints for all .vim files using breakadd file *.vim. Repeatedly issue the :cont command:

Entering Debug mode.  Type "cont" to continue.
cmd: e foo.c
>breakadd file *.vim
"foo.c" [New File]
Breakpoint in "/usr/local/Cellar/vim/8.0.1171/share/vim/vim80/ftplugin/c.vim" line 1
line 7: if exists("b:did_ftplugin")
> c
Breakpoint in "/usr/local/Cellar/vim/8.0.1171/share/vim/vim80/indent/c.vim" line 1
line 7: if exists("b:did_indent")
Breakpoint in "/usr/local/Cellar/vim/8.0.1171/share/vim/vim80/syntax/c.vim" line 1
line 7: if exists("b:current_syntax")
Breakpoint in "/Users/muru/.vim/plugged/tagbar/plugin/tagbar.vim" line 1
line 21: scriptencoding utf-8

This doesn't restrict itself to ftplugins, but it does show which plugins will be loaded just by editing this file. The breakadd pattern can changed to something like breakadd file */ftplugin/*.vim if you're only interested in files in an ftplugin directory somewhere.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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