From b9883bb6c6619c6d127f50dd57cdb37ef75f4868 Mon Sep 17 00:00:00 2001 From: juanMarinero Date: Wed, 27 Aug 2025 20:34:31 +0200 Subject: [PATCH 1/3] Issue #244 Test with next VIMRC settings: let g:table_mode_color_cells = 1 function! g:TableModeColorCellsCustom() let g:TableModeSyntaxDict.contains .= ',highPriorityCell,completeCell,infoCell' syntax match highPriorityCell /|\@<= *\![^|]*/ contained syntax match completeCell /|\@<= *X[^|]*/ contained syntax match infoCell /|\@<= *\/\/[^|]*/ contained endfunction autocmd VimEnter * call timer_start(10, {-> g:TableModeColorCellsCustom()}) --- autoload/tablemode.vim | 8 ++++---- plugin/table-mode.vim | 7 +++++++ 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/autoload/tablemode.vim b/autoload/tablemode.vim index d601634..2dfb841 100644 --- a/autoload/tablemode.vim +++ b/autoload/tablemode.vim @@ -69,10 +69,10 @@ function! s:ToggleSyntax() "{{{2 if !g:table_mode_syntax | return | endif if tablemode#IsActive() - exec 'syntax match Table' - \ '/' . tablemode#table#StartExpr() . '\zs|.\+|\ze' . tablemode#table#EndExpr() . '/' - \ 'contains=TableBorder,TableSeparator,TableColumnAlign,yesCell,noCell,maybeCell,redCell,greenCell,yellowCell,blueCell,whiteCell,darkCell' - \ 'containedin=ALL' + execute 'syntax match Table' + \ '/' . tablemode#table#StartExpr() . '\zs|.\+|\ze' . tablemode#table#EndExpr() . '/' + \ 'contains=' . g:TableModeSyntaxDict.contains + \ 'containedin=' . g:TableModeSyntaxDict.containedin syntax match TableSeparator /|/ contained syntax match TableColumnAlign /:/ contained syntax match TableBorder /[\-+]\+/ contained diff --git a/plugin/table-mode.vim b/plugin/table-mode.vim index 1b74dc5..72409b1 100644 --- a/plugin/table-mode.vim +++ b/plugin/table-mode.vim @@ -132,5 +132,12 @@ augroup END " Avoiding side effects {{{1 let &cpo = s:save_cpo +" ToggleSyntax {{{1 +let g:TableModeSyntaxDict = { +\ 'contains': 'TableBorder,TableSeparator,TableColumnAlign,' . +\ 'yesCell,noCell,maybeCell,redCell,greenCell,yellowCell,blueCell,whiteCell,darkCell', +\ 'containedin': 'ALL' +\} + " ModeLine {{{ " vim: sw=2 sts=2 fdl=0 fdm=marker From 876c21ab48f0b843d426b5fdd6ccaf438bac3b83 Mon Sep 17 00:00:00 2001 From: juanMarinero Date: Thu, 28 Aug 2025 22:19:36 +0200 Subject: [PATCH 2/3] fix: snake_case var and use tablemode#utils#get_buffer_or_global_option Test with next VIMRC settings: let g:table_mode_color_cells = 1 function! g:TableModeColorCellsCustom() let g:table_mode_syntax_dict.contains .= ',highPriorityCell,completeCell,infoCell' syntax match highPriorityCell /|\@<= *\![^|]*/ contained syntax match completeCell /|\@<= *X[^|]*/ contained syntax match infoCell /|\@<= *\/\/[^|]*/ contained endfunction autocmd VimEnter * call timer_start(10, {-> g:TableModeColorCellsCustom()}) hi highPriorityCell ctermfg=1 guifg=Red cterm=bold gui=bold hi completeCell ctermfg=2 guifg=Green cterm=bold gui=bold hi link infoCell Comment " Or make it look like comments in your colorscheme --- autoload/tablemode.vim | 5 +++-- plugin/table-mode.vim | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/autoload/tablemode.vim b/autoload/tablemode.vim index 2dfb841..aa96eea 100644 --- a/autoload/tablemode.vim +++ b/autoload/tablemode.vim @@ -69,10 +69,11 @@ function! s:ToggleSyntax() "{{{2 if !g:table_mode_syntax | return | endif if tablemode#IsActive() + let s:table_mode_syntax_dict = tablemode#utils#get_buffer_or_global_option('table_mode_syntax_dict') execute 'syntax match Table' \ '/' . tablemode#table#StartExpr() . '\zs|.\+|\ze' . tablemode#table#EndExpr() . '/' - \ 'contains=' . g:TableModeSyntaxDict.contains - \ 'containedin=' . g:TableModeSyntaxDict.containedin + \ 'contains=' . s:table_mode_syntax_dict.contains + \ 'containedin=' . s:table_mode_syntax_dict.containedin syntax match TableSeparator /|/ contained syntax match TableColumnAlign /:/ contained syntax match TableBorder /[\-+]\+/ contained diff --git a/plugin/table-mode.vim b/plugin/table-mode.vim index 72409b1..a01c7f9 100644 --- a/plugin/table-mode.vim +++ b/plugin/table-mode.vim @@ -133,7 +133,7 @@ augroup END let &cpo = s:save_cpo " ToggleSyntax {{{1 -let g:TableModeSyntaxDict = { +let g:table_mode_syntax_dict = { \ 'contains': 'TableBorder,TableSeparator,TableColumnAlign,' . \ 'yesCell,noCell,maybeCell,redCell,greenCell,yellowCell,blueCell,whiteCell,darkCell', \ 'containedin': 'ALL' From 94d13f9215ecf284d0a10f80dbb027a17a689ab2 Mon Sep 17 00:00:00 2001 From: Dhruva Sagar Date: Mon, 1 Sep 2025 06:13:43 +0530 Subject: [PATCH 3/3] Update table-mode.vim --- plugin/table-mode.vim | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/plugin/table-mode.vim b/plugin/table-mode.vim index a01c7f9..c5a9485 100644 --- a/plugin/table-mode.vim +++ b/plugin/table-mode.vim @@ -57,6 +57,12 @@ call s:SetGlobalOptDefault('table_mode_sort_map', g:table_mode_map_prefix.'s') call s:SetGlobalOptDefault('table_mode_tableize_map', g:table_mode_map_prefix.'t') call s:SetGlobalOptDefault('table_mode_tableize_d_map', 'T') +call s:SetGlobalOptDefault('table_mode_syntax_dict', { +\ 'contains': 'TableBorder,TableSeparator,TableColumnAlign,' . +\ 'yesCell,noCell,maybeCell,redCell,greenCell,yellowCell,blueCell,whiteCell,darkCell', +\ 'containedin': 'ALL' +\}) + call s:SetGlobalOptDefault('table_mode_syntax', 1) call s:SetGlobalOptDefault('table_mode_auto_align', 1) call s:SetGlobalOptDefault('table_mode_update_time', 500) @@ -132,12 +138,5 @@ augroup END " Avoiding side effects {{{1 let &cpo = s:save_cpo -" ToggleSyntax {{{1 -let g:table_mode_syntax_dict = { -\ 'contains': 'TableBorder,TableSeparator,TableColumnAlign,' . -\ 'yesCell,noCell,maybeCell,redCell,greenCell,yellowCell,blueCell,whiteCell,darkCell', -\ 'containedin': 'ALL' -\} - " ModeLine {{{ " vim: sw=2 sts=2 fdl=0 fdm=marker