dhruvasagar / vim-table-mode

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

using table mode with vimwiki #110

Closed skrobul closed 7 years ago

skrobul commented 7 years ago

I know this has been briefly discussed in #47, but wanted to ask for a little help with fixing this. There obviously is a conflict with vimwiki mappings and comment string, but a lot (if not most) of vimwiki users don't use their syntax, but use markdown instead.

This is what I have tried so far:

  1. Given that it's just a markdown file, I attempted setting comment string to set commentstring="> %s"
  2. To remove conflict with insert mode mapping on <CR> and Tab I have added let g:vimwiki_table_mappings = 0 to my vimrc

Above two steps get rid of error from issue 47 but vim-table-mode does not work as expected. When I enable it and create new column it seems ok, but after creating next column cursor ends up on wrong side of the | separator. Any ideas what might be causing this?

dhruvasagar commented 7 years ago

Will have to debug this.

skrobul commented 7 years ago

ok cool, let me know if there is anything I can do to help

McKean commented 7 years ago

Hello I'm also having issues getting this to work with vimwiki. This is the output I get when enabling table mode.

Error detected while processing function tablemode#Toggle[6]..<SNR>183_SetActive[2]..<SNR>183_ToggleSyntax:                   
line    4:                                                                                                                    
E867: (NFA) Unknown operator '\%%'                                                                                            
E71: Invalid character after \%                                                                                               
E475: Invalid argument: Table /^\s*\(\%\%\)\?\s*\zs|.\+|\ze\s*$/ contains=TableBorder,TableSeparator,TableColumnAlign containe
din=ALL

I have included the 2 points mentioned by @skrobul but that didn't help for me.

dhruvasagar commented 7 years ago

Hi,

Sorry for the lack of response and delay. I'll take a close look at this and revert back asap. The problem is with special characters / escaping within the regex used for comparison. Might require bit of work around.

cstsunfu commented 7 years ago

If this plugin could work with vimwiki. It will be the most powerful plugin in vim when we calculate the table. Thanks for your work. I love this plugin.

nowakf commented 7 years ago

+1 - would love to use tables in vimwiki.

dhruvasagar commented 7 years ago

Can someone share an example vimwiki document where I can try this ? I have more time on my hands now, will act on this fast.

nowakf commented 7 years ago

Here: Merse108.zip

dhruvasagar commented 7 years ago

Hi, I have made changes to get it to play nicely with vimwiki.

However In order to use vim table mode over vimwiki native table formatting support you need to add the following vimwiki settings to your vimrc :

let g:vimwiki_table_mappings=0
let g:vimwiki_table_auto_fmt=0
dhruvasagar commented 7 years ago

With those settings vim table mode seems to be working fine within vimwiki documents. Kindly use it more and let me know if you face any other issues.

dhruvasagar commented 7 years ago

Btw @skrobul this fix doesn't require changing the comment string to something else, however that change shouldn't create further issues. Regarding getting it working, well it just required also disabling vimwiki auto formatting for tables which was causing some interference, once that is disabled with the g:vimwiki_table_auto_fmt=0 setting, it seems to work as expected.

nowakf commented 7 years ago

Awesome!

McKean commented 7 years ago

strange, this is not doing it for me. I get the following error when I want to turn on Table Mode. This only happens in VimWiki...

Error detected while processing function tablemode#Toggle[6]..<SNR>194_SetActive[2]..<SNR>194_ToggleSyntax:                                                                                                                                                    
line    4:                                                                                                                                                                                                                                                     
E867: (NFA) Unknown operator '\%%'                                                                                                                                                                                                                             
E71: Invalid character after \%                                                                                                                                                                                                                                
E475: Invalid argument: Table /^\s*\(\%\%\)\?\s*\zs|.\+|\ze\s*$/ contains=TableBorder,TableSeparator,TableColumnAlign containedin=ALL                                                                                                                          
Table Mode Enabled

on neovim 0.2.0

dhruvasagar commented 7 years ago

Are you sure you updated vim-table-mode to the latest commit ? The error isn't indicative of that.

nowakf commented 7 years ago

Works for me, just ran :PlugUpdate, and everything's golden. Thanks so much for this awesome plugin.

skrobul commented 7 years ago

sorry, I'm bit late to the party. Just tested new version and it works, awesome!!! Thank you!

McKean commented 7 years ago

@dhruvasagar whoops, didn't update, didn't read your comment properly and thought the config lines were all there was. Works like a charm, thanks!

MartyLake commented 1 month ago

I documented a working example of table formula when integrating with vimwiki, it may interest some of you. https://gist.github.com/MartyLake/f6dd46bb479d402b15b32791ababaa28