dhruvasagar / vim-table-mode

VIM Table Mode for instant table creation.
2.11k stars 96 forks source link

Auto formatting doesn't work well with ReST table #151

Closed idnsunset closed 5 years ago

idnsunset commented 5 years ago

For table cell spanning rows/columns, or table cell content containing vertical bars, the auto formatting behaves incorrectly. Am I missing some options or the plugin doesn't handle this kind of situations?

dhruvasagar commented 5 years ago

Can you share an example ?

jm33-m0 commented 5 years ago

basically it looks like this:

+----+-----+
| 1 | 2 | 3 |
+===|===|===+ // this line is auto generated by typing `||`
| 4 | 5 | 6 |
+----+---+
jm33-m0 commented 5 years ago

it should look like this, however

let g:table_mode_corner_corner='+'
let g:table_mode_header_fillchar='='

+-----------------+--------------------------+------------+
| name            | address                  | phone      |
+=================+==========================+============+
| John Adams      | 1600 Pennsylvania Avenue | 0123456789 |
+-----------------+--------------------------+------------+
| Sherlock Holmes | 221B Baker Street        | 0987654321 |
+-----------------+--------------------------+------------+
dhruvasagar commented 5 years ago

For me, it does look like this :

+-----------------+--------------------------+------------+
| name            | address                  | phone      |
+=================+==========================+============+
| John Adams      | 1600 Pennsylvania Avenue | 0123456789 |
| Sherlock Holmes | 221B Baker Street        | 0987654321 |
+-----------------+--------------------------+------------+
dhruvasagar commented 5 years ago

Or like this with the additional border in between the 2 rows :

+-----------------+--------------------------+------------+
| name            | address                  | phone      |
+=================+==========================+============+
| John Adams      | 1600 Pennsylvania Avenue | 0123456789 |
+-----------------+--------------------------+------------+
| Sherlock Holmes | 221B Baker Street        | 0987654321 |
+-----------------+--------------------------+------------+
dhruvasagar commented 5 years ago

It will look like this :

+------------|--------------------------|------------+
| name       | address                  | phone      |
+============|==========================|============+
| John Adams | 1600 Pennsylvania Avenue | 0123456789 |
+------------|--------------------------|------------+
| John Adams | 1600 Pennsylvania Avenue | 0123456789 |
+------------|--------------------------|------------+

With the following settings :

let g:table_mode_corner='|' " Not default
let g:table_mode_corner_corner='+' " Not default
let g:table_mode_header_fillchar='=' "Not default
dhruvasagar commented 5 years ago

@idnsunset @jm33-m0 sorry I just realized this was for rst files. So for this issue I will direct you to #142