vim-table-mode icon indicating copy to clipboard operation
vim-table-mode copied to clipboard

Feature Request - Support multi-line cells

Open idvorkin opened this issue 10 years ago • 21 comments

I love VIM, and the table plugin is great. For single line cells it's perfect. It would be awesome if multi line cells where supported. This is how table functionality works in OneNote, and it's a dream. Here's an example:

image

I haven't thought through what the multi line cell UX should be in VIM, but if someone is interested in working on this, I can spend time thinking about it.

idvorkin avatar Sep 29 '15 02:09 idvorkin

Technically, this is already possible. You just choose where to draw the line separators, which aren't a necessity anymore.

dhruvasagar avatar Sep 29 '15 06:09 dhruvasagar

Although from vim-table-mode's perspective they are 2 separate rows, but that shouldn't be a problem I believe. Unless you need something more.

dhruvasagar avatar Sep 29 '15 06:09 dhruvasagar

That's a great way to proceed. Let me list out a few features I use often in OneNote tables, to see if there's a good map to vim-table-mode:

A) Re-order rows (as opposed to lines) by erasing and pasting.

From table example:

Put cursor on [C] hit dd, and then move up to [A] and hit p. 
Expect both 'lines' in row C to move. 

B) Add a line within a multi line cell, by hitting enter (equivalent of o/O) will be cell relative.

From table example:

Put cursor on 'Two Row' hit o
Expect cursor under 'Two Row' so can type Three Row in the same cell.

idvorkin avatar Sep 29 '15 13:09 idvorkin

A) You could just do 2dd B) Again you can always press O from the border line or o from the last line where you actually intend the same.

I can understand how these may seem slightly inconvenient but they also allow for more flexibility and ease.

dhruvasagar avatar Sep 29 '15 13:09 dhruvasagar

Is there a way I can press o, and stay in the same cell (vs go to the start of the next row?) See gif @ link: http://i.imgur.com/QID8Xxj.gifv

idvorkin avatar Sep 29 '15 16:09 idvorkin

ah, well no. That I can look into supporting.

dhruvasagar avatar Sep 29 '15 16:09 dhruvasagar

Awesome. Tell me as you think about this. I'm happy to brainstorm approaches if you'll find that helpful.

idvorkin avatar Sep 29 '15 19:09 idvorkin

Well I have been meaning to add more editing supports like the one you mentioned for a while. Things like adding a cell under the current cell, move cells etc.

dhruvasagar avatar Sep 29 '15 19:09 dhruvasagar

I was just about to suggest this too. Having o or J commands restricted to a cell would be really useful, or some similar commands that achieve the same thing.

That functionality could also open up the possibility of resizing rows and columns with multi-line wrapping for each cell.

rafaqz avatar Oct 26 '15 03:10 rafaqz

Multi lines or being able to set max column widths with wrapping would be great. I use table mode with dbext to format the results a lot better.

The only issue is columns with large text fields means large columns.

flukus avatar Jun 11 '16 01:06 flukus

ok gotta shift gears soon.

dhruvasagar avatar Jun 13 '16 09:06 dhruvasagar

Does the inability to edit multi-line tables, specifically without them flowing to the side as a new column, go as part of this feature request? :) I was hoping to edit the table and having the columns follow. If not, I'll create a new issue if desired.

thor avatar Jul 10 '17 07:07 thor

Bump, multiline cells and/or fixed cell width for auto wrapping would be great to have!

ffledgling avatar Feb 20 '18 19:02 ffledgling

I would also like to use such a feature

linus-gates avatar Nov 29 '20 14:11 linus-gates

I'm so motivated to have multi-line cells, can we be of any help on this ?

LuisBL avatar Jan 24 '21 14:01 LuisBL

I have started receiving sponsorship recently and some folks have been generous. I am going to start allocating more time / day. Other than sponsoring, feel free to take a stab and submit a PR, I can help you get through if required.

dhruvasagar avatar Feb 09 '21 16:02 dhruvasagar

This seems like a very common use case, but I've searched and couldn't find a solution. Has anybody found one? There is this plugin for Obsidian which implements the markdown table syntax to include multiline cells, rowspan (long) cells and colspan (tall) cells. I'm very surprised that there doesn't seem to be an equivalent for it in Vim?

arisolt avatar Jan 15 '23 09:01 arisolt

@arisolt Thanks for sharing that, this looks like a pretty good approach, i'll take a look at it.

dhruvasagar avatar Jan 15 '23 16:01 dhruvasagar

That would also work really well with this jekyll plugin which seems to use the same markdown scheme.

davy79 avatar Mar 02 '23 12:03 davy79

multiple lines per cell will be great, is this supported now?

laoshaw avatar Mar 12 '24 01:03 laoshaw

@laoshaw No, not yet. I would be happy to review a PR :). I am struggling to find large chunks of time to work on features, mostly focusing on bug fixing and improving test coverage.

dhruvasagar avatar Mar 12 '24 08:03 dhruvasagar