Question

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.

Was it helpful?

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.

OTHER TIPS

Add the below lines to $HOME/.vimrc

set tabstop=4
set shiftwidth=4
set expandtab

This should set a tab to 4 spaces.
Here is the VIM Wiki on this: http://vim.wikia.com/wiki/Converting_tabs_to_spaces

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top