From 9921b311cd60be82e4acbdd4637d159f148bed91 Mon Sep 17 00:00:00 2001 From: Matt Wozniski Date: Sat, 19 Nov 2016 13:55:58 -0500 Subject: [PATCH] Don't pad after 1st field if it's always empty Further special case the 1st field of a line so that if it is blank for all lines, the padding after it won't be added. This prevents another case of padding creep, where each run through would add (the default) space after the empty field, and the next run through would preserve that space as leading indent, and add a new one after the first field (which would be blank again, because leading indent had been stripped). --- autoload/tabular.vim | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/autoload/tabular.vim b/autoload/tabular.vim index cbf3908..0363aff 100644 --- a/autoload/tabular.vim +++ b/autoload/tabular.vim @@ -302,6 +302,11 @@ function! tabular#TabularizeStrings(strings, delim, ...) let field = s:Center(line[i], maxes[i]) endif + if i == 0 && maxes[i] == 0 + " If the first field is blank on all lines, don't pad after it + let pad = 0 + endif + let line[i] = field . repeat(" ", pad) endfor