Search code examples
vimalignmentindentationauto-indent

How to use tabs as horizontal indentation and spaces as vertical indentation in Vim?


Is there a way to configure Vim so it combines tabs to use as horizontal indentation character, and spaces as vertical indentation character (for instance, when continuing long lines, giving out arguments to methods)? Basically, something like this (i have marked tabs with > and spaces with dot):

class xyz {
>   function abc()
>   {
>   >   $var1 = "this is a multi-"
>   >   ......+ "line string which spans "
>   >   ......+ "several lines";
>   }
}

Ideas or suggestions?

Edit: I'm not looking how to use spaces instead of tabs, I'd like to combine them in a way I described above.


Solution

  • There is a "Smart Tabs" script that may be what you're looking for. It describes itself as using tabs for indentation and spaces for alignment.