mirror of
https://github.com/dhruvasagar/vim-table-mode.git
synced 2025-11-08 11:03:47 -05:00
Fixed #26
Not assuming a length for alignments, looping through all and adding 'l' as default first then updating as per the column alignments.
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user