Closed roryokane closed 8 years ago
As I replied:
I think that most people want shiftwidth
to equal tabstop
. I can see four options for allowing that while supporting different values:
shiftwidth
You would set shiftwidth=2
in your vimrc. Most people would set shiftwidth=0
in their vimrc.
The problem with this is that a 0
value for shiftwidth
is not supported in Vim versions below 7.4, which some people might be stuck on. So with this behavior, some people would always have to set shiftwidth
manually to the detected tabstop
value, defeating part of the purpose of the plugin.
shiftwidth
if it doesn’t support a 0
valueI could have the plugin detect whether this Vim supports a 0
value, and change shiftwidth
only if it doesn’t support 0
. That would make the plugin still valuable for people on old Vim, while giving people freedom on newer Vims. But I think the inconsistency would be confusing for people who upgrade Vim – suddenly, shiftwidth
stops being set right and the plugin asks them to add something to their vimrc. “I thought upgrading was supposed to make things better,” they would complain.
A secondary problem for both of the above options is that they requires people to set shiftwidth
in their vimrc, which perhaps not everybody does. And most people who set it probably haven’t heard of the 0
value required to make it work always, so they will still be frustrated if they set it to 4
and load a file with 2-space indents. We could educate them in the README for this plugin – put changing their vimrc in the instructions – and that would be the best compromise, but it would still require people to do more work to install this than they do today.
shiftwidth
alone only if some option is setI don’t see a way to automatically detect from the user’s settings whether they want shiftwidth
to be left alone. Thus, I would have to add a new option, something like g:detectindent_use_global_shiftwidth
.
Most of the time, the plugin would set shiftwidth
. But if that option exists and is set to 1, it would leave shiftwidth
unchanged.
I think this would work. It would make the code a little more complex, and add a new option, but that seems unavoidable.
Or if the value for shiftwidth
that you want isn’t always 2 – if it is different for different files, while also being different from tabstop
sometimes – then your only option is to run :DetectIndent
, and then run :set shiftwidth=3
or whatever.
From these four choices, I am guessing you would prefer adding a Vim option to leave shiftwidth
alone. Is that correct? Do you disagree with any premise? Do you see any other options, or reasons to choose an option that I have missed?
Since I haven’t gotten any feedback from @blueyed, who raised this issue, I assume that “Current situation – you change it manually” from the four options above is good enough for him. So I am closing this issue.
@blueyed in issue #4:
I am moving his post to a new issue with a different, more applicable title. This way, issue #4 can be used to discuss the separate matter which was its original title, whether
shiftwidth
should be set to 0 or not.