nvim-lua / wishlist

A public catalogue of Lua plugins Neovim users would like to see exist
MIT License
235 stars 0 forks source link

Orgmode-like table completion #28

Open rambip opened 3 years ago

rambip commented 3 years ago

What? I'm looking for a special kind of completion, that I only ever saw in emacs orgmode: table completion ( you tab inside a markdown table and it is completed foe you)

Why? Vim is about repeatable atomic edits, but it just doesn't work with tables. A smarter completion is required in these cases.

Potential existing implementations: There is an orgmode plugin for neovim that I didn't try, but I don't need all this functionality.

*Potential pitfalls:* One of the things that could be challenging is detecting when you're inside a table. Also, this could mess up with the tab completion. Maybe emacs way of doing it is not the best idea for neovim. Maj+enter could be a good keybinding for that. And I have no idea how that could integrate with treesiter.

bew commented 3 years ago

What kind of completion do you expect and isn't currently available?

rodamaral commented 3 years ago

Not that I use any of these, but there's also this plugin https://github.com/vhyrro/neorg

rambip commented 3 years ago

I think the table completion is on their todo-list, they still didn't implement it. What I would like is a way to start creating a table like that:

| foo | bar |

Then hit something like maj+enter, and that would escape, create a new line, and drop me in insert mode like that:

| foo | bar |
|-------|-------|
| x      |        |

And when I insert a text inside a cell and I go back to normal mode, the entire table would be re-indented:

| foo | bar |
|------|--------|
| really long thing | short |

Would became (when I hit enter)

|              foo            |  bar   |
|---------------------------|---------|
| really long thing | short |

And ideally, there could be text-objects like "cell" to use as a usual text-object (like dic deletes the content of a cell and reformat the table)

skbolton commented 1 year ago

Vimwiki has this feature. You could add that or yoink the logic into a dedicated plugin.