With shiftwidth=0, Vim uses the value of tabstop, but &sw is 0. So multiline tags and brackets got wrong indent, and fold levels were wrong as indent was divided by 0. Use shiftwidth() instead, which is the same as &sw when it isn't 0.