I believe your issue is that your shiftwidth
is twice your tabstop
. You are also setting tabstop
twice, once at the top to 4 and again at the bottom to 1.
Try setting shiftwidth
to the same at tabstop
, there really aren't many cases that you'd want these two to be different.