dhruvasagar / vim-table-mode

VIM Table Mode for instant table creation.
2.1k stars 97 forks source link

plugin issue with markdown #140

Closed crocme10 closed 4 years ago

crocme10 commented 5 years ago

Hello,

I have an issue whereby the plugin does not reallign columns correctly when the file is in markdown, but it works in text. I've reproduced this problem with both vim (8.1) and neovim (0.3.4) on linux. In both cases, the configuration is

set nocompatible
filetype plugin indent on
call plug#begin('~/.vim/plugged')
"All
Plug 'dhruvasagar/vim-table-mode'

call plug#end()

" Key remaps
let mapleader=","

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

If I make some modifications to a file test.md (markdown is important), enable Table Mode, the plugin will sort of squeeze the column separators like so:

1   +----------------+----------+
  1 | name | date |
  2 +================+==========+
  3 | bob | 2018/03/13 |
  4 +----------------+----------+
  5 | alice | 2018/03/13 |
  6 +----------------+----------+
  7

But if I move that file to test.txt, enable table mode, wiggle one cell, it reallign the text correctly:

 1 +-------+------------+
2   | name  | date       |
  1 +=======+============+
  2 | bob   | 2018/03/13 |
  3 +-------+------------+
  4 | alice | 2018/03/13 |
  5 +-------+------------+

Any idea what I'm doing wrong?

(I've had this problem for about a month, it was working fine before that)

Thanks in advance

crocme10 commented 5 years ago

I think this 'error' that I am seeing is a side effect of the automatic detection of corners according to filetype (commit 5c3c30). I use pandoc to transform my markdowns, and pandoc has a plugin to accept ReST style tables in markdown.

SolidTux commented 4 years ago

I've got the same problem. It can be fixed in the config by using

augroup mdtable
    autocmd!
    autocmd BufWritePre *.md let b:table_mode_corner ='+'
    autocmd BufWritePre *.md let b:table_mode_corner_corner='+'
    autocmd BufWritePre *.md let b:table_mode_header_fillchar='='
augroup END
dhruvasagar commented 4 years ago

Kindly refer to https://github.com/dhruvasagar/vim-table-mode/issues/148