commit 23d273d54711035ac2b1c19838438521f0982595
parent 7730fa28b536f06b7701166e3fc54c23e1338682
Author: Steven Schmeiser <steven@schmeiser.org>
Date: Mon, 9 Jul 2018 10:05:30 -0400
table alignment: break out of loop when separator found
Diffstat:
2 files changed, 11 insertions(+), 9 deletions(-)
diff --git a/autoload/vimwiki/tbl.vim b/autoload/vimwiki/tbl.vim
@@ -237,7 +237,9 @@ endfunction "}}}
function! s:get_cell_aligns(lnum) "{{{
let aligns = {}
for [lnum, row] in s:get_rows(a:lnum)
+ let found_separator = 0
if s:is_separator(row)
+ let found_separator = 1
let cells = vimwiki#tbl#get_cells(row)
for idx in range(len(cells))
let cell = cells[idx]
@@ -249,15 +251,15 @@ function! s:get_cell_aligns(lnum) "{{{
let aligns[idx] = 'left'
endif
endfor
- else
- let cells = vimwiki#tbl#get_cells(row)
- for idx in range(len(cells))
- if !has_key(aligns, idx)
- let aligns[idx] = 'left'
- endif
- endfor
+ return aligns
endif
endfor
+ if !found_separator
+ let cells = vimwiki#tbl#get_cells(row)
+ for idx in range(len(cells))
+ let aligns[idx] = 'left'
+ endfor
+ endif
return aligns
endfunction "}}}
diff --git a/doc/vimwiki.txt b/doc/vimwiki.txt
@@ -1658,8 +1658,8 @@ values: >
To indent table indent the first row. Then format it with 'gqq'.
-You can specify horizontal alignment for columns in the separator. The
-default is left-align. >
+You can specify the type of horizontal alignment for columns in the separator
+using the ':' character. The default is left-align. >
| Date | Item | Price |
|------------|:------:|--------:|