Updated Table Formulas

- Added single function for both command & mapping to take formula from
  input.
- Reusing g:table_mode_align for formatting table content, which was
  missed when moving from :Tableize to tabular#TabularizeStrings
- Correctly parsing ranges as strings.
This commit is contained in:
Dhruva Sagar
2013-05-14 19:35:00 +05:30
parent 2bde444575
commit e9d9030cbb
2 changed files with 50 additions and 39 deletions

View File

@@ -383,7 +383,13 @@ function! s:ParseRange(range, ...) "{{{2
let default_col = a:1
endif
let [rowcol1, rowcol2] = split(a:range, ':')
if type(a:range) != type('')
let range = string(a:range)
else
let range = a:range
endif
let [rowcol1, rowcol2] = split(range, ':')
let [rcs1, rcs2] = [map(split(rowcol1, ','), 'str2nr(v:val)'), map(split(rowcol2, ','), 'str2nr(v:val)')]
if len(rcs1) == 2
@@ -535,7 +541,7 @@ function! tablemode#TableRealign(line) "{{{2
let tline = tline + s:RowGap()
endwhile
call tabular#TabularizeStrings(lines, g:table_mode_separator)
call tabular#TabularizeStrings(lines, g:table_mode_separator, g:table_mode_align)
for lnum in lnums
let index = index(lnums, lnum)