Skip to content

Commit

Permalink
Don't pad after 1st field if it's always empty
Browse files Browse the repository at this point in the history
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).
  • Loading branch information
Matt Wozniski committed Nov 19, 2016
1 parent a6ef92c commit 9921b31
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions autoload/tabular.vim
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 9921b31

Please sign in to comment.