Closed inkarkat closed 11 years ago
No it shouldn't. I don't set b:did_ftplugin
I just check for it. If you have more than one html ftplugin in your user directory then you can create a subdirectory and rename as you like. e.g. ~/.vim/ftplugin/html/matchtag.vim
My argument still holds. Whether you rename to ftplugin/html/matchtag.vim
or ftplugin/html_matchtag.vim
is irrelevant. But the ftplugin/html.vim
should be reserved to hold the main settings for the filetype, not add-on functionality. Of course, this is just convention, but IMHO a good one.
In add-ons, you do not need to check for b:did_ftplugin
; that is just so that a ftplugin in ~/.vim
is able to override (again, the main filetype settings of) the system-wide one. With this check in place, your plugin must be sourced before the system-wide one, or else the guard is active. So, if I had a ~/.vim/ftplugin/html.vim
override of the system-wide one (and renamed your plugin as you've just suggested), the guard would prevent your plugin from becoming active. As long as your plugin doesn't ship with Vim, there's no need to check the / have a guard; users who don't want this functionality simply don't install your plugin.
Your useful plugin does not provide core ftplugin functionality (like setting
'iskeyword'
,'wrap'
, etc.), but rather ancilliary functionality. Therefore, it should be renamed tohtml_matchtag.vim
(andxml_matchtag.vim
), and this guard dropped:Otherwise, this prevents the default
$VIMRUNTIME/ftplugin/html.vim
from becoming effective.