Closed paniash closed 4 years ago
Thanks for the contribution!
Just out of curiosity, what's the difference between the original code that I wrote and your suggestion. The original works fine on my setup so was just wondering. Thanks!
@paniash Besides just being a VIM rule, the reason for the rule is so that other plugins don't mess up your intended behavior. In the case of your initial version for example another plugin could come along and add their own hook to the FileType and blow yours away. It wouldn't even have to be a syntax plugin, it could be anything, but it would nuke your rule and it would appear like this plugin just suddenly stopped working. It wouldn't be our fault and it might even happen when a user updated plugins so they would assume we did something to break it — but the culprit would be the lack of a group namespace on their autocommand hook that allowed it to get blown away by something unrelated.
Another issue (and the reason I added the !
modifier on you) is so that reloading your config file doesn't cause the hook to be setup twice, which can also create weird unwanted behavior.
Thank you very much for the detailed answer :) @alerque.
Apologies for that. I have made the changes that you suggested. Thanks!