From 7810ce0ca04f7b695722af83ac7902a04e281f90 Mon Sep 17 00:00:00 2001 From: Dhruva Sagar Date: Sat, 26 Apr 2014 23:52:18 +0530 Subject: [PATCH] Fixed #26 Not assuming a length for alignments, looping through all and adding 'l' as default first then updating as per the column alignments. --- autoload/tablemode/align.vim | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/autoload/tablemode/align.vim b/autoload/tablemode/align.vim index ae3f6cc..b54b67e 100644 --- a/autoload/tablemode/align.vim +++ b/autoload/tablemode/align.vim @@ -118,11 +118,12 @@ function! tablemode#align#Split(string, delim) endfunction function! tablemode#align#alignments(lnum, ncols) "{{{2 - let alignments = repeat(['l'], a:ncols) " For each column + let alignments = [] if tablemode#table#IsHeader(a:lnum+1) let hcols = tablemode#align#Split(getline(a:lnum+1), '[' . g:table_mode_corner . g:table_mode_corner_corner . ']') for idx in range(len(hcols)) " Right align if header + call add(alignments, 'l') if hcols[idx] =~# g:table_mode_align_char . '$' | let alignments[idx] = 'r' | endif if hcols[idx] !~# '[^0-9\.]' | let alignments[idx] = 'r' | endif endfor