0

I'm trying to understand why my ftplugin isn't loaded. To get at least some understanding what's going on, I've tried

strace -e file gvim test.cpp |& grep ftplugin

But this gave me empty output, although :set ft says cpp. I do have lots of files in /usr/share/vim/vim74/ftplugin, and cpp.vim is among them. My $VIMRUNTIME is /usr/share/vim/vim74. So apparently Vim doesn't even try to load any ftplugin, although it does load e.g. tarPlugin.vim and others in the plugin directory (not ftplugin).

What could be wrong in my config that would make Vim not even consider any ftplugins?

1

1) If you want to strace gvim, you need to make sure, that it does not fork.

2) filetype plugins are only loaded if your .vimrc contains a line like filetype plugin indent on (with or without indent, depending if you want indent plugins to be loaded as well.)

Read the help at :h filetype-plugin-on and the following paragraphs.

  • 1) can be dealt with by strace -f. But anyway, gvim only forks after loading the plugins. As for 2), why do I need indent if simple filetype plugin on would do (as given by the help page you reference)? – Ruslan Mar 24 '17 at 18:31
  • 1) That is not correct. gvim loads ftplugins whenever a new buffer is loaded, so it is not true, that this only happens before gvim forks. 2) this depends on whether or not you want customized indenting to apply per filetype – Christian Brabandt Mar 25 '17 at 10:11

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.