N.B I use the word blank here due to lack of a better word. By blank I mean the remaining part of a tab that is visualized after the starting part. Please feel free to edit this question.
I know there are questions already answered about vim's indent with tabs and align with spaces. But those questions have answers that says it's not possible or possible with supertab plugin. And moreover, my question is a little bit specific.
Take this example,
function! Format_tabs() abort >...let s = '' >...let s .= repeat(' ', &ts) >...let t = '>..>...hello there>>...hey' >...echo substitute(t, '\v[^\t]+\zs\t+\ze', s, 'g') endfunction
> are start of a tab and following
. are the remaining blank part throughout the tabstop.
And my tabstop settings are all set to 4.
In the above function I'm trying to convert the tabs in the string that are not at the beginning of a line with equivalent number of spaces. At the beginning I thought, I could replace each tabs, that are not at the beginning, with &tabstop number of spaces. But it turns out due to some settings, that I'm not trying to change, the tabs show different amount of blanks to figure out the alignment. So I need to figure out how many spaces I need to substitute the tabs for. But I have no idea!