I recently started using vim 7 (previously vim 6) and the smartindent
setting. For the most part, it works well, though I'm so used to typing a tab after an open brace that it is almost counter-productive.
However, there is one piece of maniacal behaviour. When editing a shell script, I try to create a comment at the current indent level, but smartindent
will have nothing to do with it. It insists that the comment must be at level 0 (no indent). What's worse, it breaks shift-right ('>>
' and friends) so that they do not work. This is outright insubordination, and I'd like to know what's the best way to fix it?
(I'm also not keen on smartindent
's ideas about indenting then
after if
.)
Preferred solutions will save me manual bashing - I'm being lazy. One option would be 'turn off smartindent
when editing shell scripts (leave it on for the rest)'. Another option would be guidelines on how to find the control script for smartindent
and what to edit to change the characteristics I don't like. The final option (which I don't need advice on how to do - just the hint that it is the best, or only, way to restore sanity) is to leave smartindent
unset.
I saw the vaguely related question on "(PHP and) annoying vim unindent rules"; it doesn't provide me with the direct answer, though maybe the cindent
and related items mentioned in there are in fact part of the answer.