Don't add leading space in empty first column

This commit is contained in:
Tim Pope 2009-12-20 15:35:57 +08:00 committed by Matt Wozniski
parent 68d1d3a41b
commit c5fcca78ab

View File

@ -206,6 +206,8 @@ function! tabular#TabularizeStrings(strings, delim, ...)
endfor
endfor
let lead_blank = empty(filter(copy(lines), 'v:val[0] =~ "\\S"'))
" Concatenate the fields, according to the format pattern.
for idx in range(len(lines))
let line = lines[idx]
@ -221,7 +223,7 @@ function! tabular#TabularizeStrings(strings, delim, ...)
let field = s:Center(line[i], maxes[i])
endif
let line[i] = field . repeat(" ", pad)
let line[i] = field . (lead_blank && i == 0 ? '' : repeat(" ", pad))
endfor
let lines[idx] = s:StripTrailingSpaces(join(line, ''))