Should user-set options like shiftwidth & tabstop be overriden by built-in "recommended styles"?

I’m thinking of submitting a bug report since I really don’t think this should be the case, but I want some thoughts first.

I just spent a while wondering why setting shiftwidth or tabstop didn’t apply to markdown files … and its because of markdown_recommended_style being set to 1 by default, which overrides those values to 4: neovim/runtime/ftplugin/markdown.vim at d25889ab7607918a152bab5ce4d14e54575ec11b · neovim/neovim · GitHub.

If a user wants different values specifically for markdown then they can easily set it on their own, more easily than finding out the hard the way that its being overridden. I kept looking it up and found out in a reddit comment.

helpgrep markdown_recommended_style :


MARKDOWN                                                *ft-markdown-plugin*

To enable folding use this: >
	let g:markdown_folding = 1

'expandtab' will be set by default.  If you do not want that use this: >
	let g:markdown_recommended_style = 0

I believe the idea of having the default (bundled) filetype plugins override those kind of settings is inherited from Vim. See e.g. Vim: filetype.txt (which however seems to only set ‘expandtab’). I would agree that it is not the best user experience. I guess the original intent was to ship some “sane defaults” for e.g. Makefiles which always use tabs, so that users don’t have to repeat too many filetype setting mantras in their configs, etc. You may start a report about this, but I suspect there will be some who will invoke the Vim behaviours to justify keeping things as they are. There is a tradeoff here between simplicity (homogeneity) and convenience.

If the format only supports tabs or spaces then sure but if it’s just a suggestion I think the user’s settings should be respected. Most languages support both and in those cases many users prefer to use their preference.

I just ran into this and it took me quite a bit of searching to figure out the culprit even.

And while I get it for languages like Python, where it’s an actual programming language with a PEP that tells you to do this, this should never be done for something like markdown, where there really is no justification whatsoever.

In fact, it can be actively harmfull, if you for example want to describe a makefile in a codeblock, like:

foo: bar
	cp $< $@

With the current configuration neovim essentially decides on its own that it doesn’t want this to work and breaks the resulting code. That’s bad!

I can kinda see the behavior as an opt-in, but as an opt-out this is really a terrible idea, even more so since this definitely not as an opt-out.

Now, this specific instance was the result of an upstream patch it seems, but I’d say that if anything this is indicative that not everything should blindly be taken from upstream. It’s also somewhat recent, making this arguably a breaking change…