Smart tabs in vim

vim

Solution

There is the Smart Tabs plugin. I don't use it, but it looks like it does what you want.

Edit: Actually, I have written my own implementation of this, because I wanted some additional features (like still use Tabs after a comment prefix), and needed it to integrate with my own variant of the SuperTab plugin, which also overrides the key. I've just uploaded my IndentTab plugin, so that you have a choice.

Problem

Is there any way to make vim handle `tab` pressing by the next two ways? - Insert usual tab for indent. - Insert spaces for alignment. Result of usage should looks as follows (`--->` it's tabs, `_` it's spaces) ``` foo() { --->int_a_____=_2; --->int_count_=_12; } ```

Original source