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
This commit is contained in:
juanMarinero
2025-08-28 22:19:36 +02:00
parent b9883bb6c6
commit 876c21ab48
2 changed files with 4 additions and 3 deletions

View File

@@ -69,10 +69,11 @@ function! s:ToggleSyntax() "{{{2
if !g:table_mode_syntax | return | endif if !g:table_mode_syntax | return | endif
if tablemode#IsActive() if tablemode#IsActive()
let s:table_mode_syntax_dict = tablemode#utils#get_buffer_or_global_option('table_mode_syntax_dict')
execute 'syntax match Table' execute 'syntax match Table'
\ '/' . tablemode#table#StartExpr() . '\zs|.\+|\ze' . tablemode#table#EndExpr() . '/' \ '/' . tablemode#table#StartExpr() . '\zs|.\+|\ze' . tablemode#table#EndExpr() . '/'
\ 'contains=' . g:TableModeSyntaxDict.contains \ 'contains=' . s:table_mode_syntax_dict.contains
\ 'containedin=' . g:TableModeSyntaxDict.containedin \ 'containedin=' . s:table_mode_syntax_dict.containedin
syntax match TableSeparator /|/ contained syntax match TableSeparator /|/ contained
syntax match TableColumnAlign /:/ contained syntax match TableColumnAlign /:/ contained
syntax match TableBorder /[\-+]\+/ contained syntax match TableBorder /[\-+]\+/ contained

View File

@@ -133,7 +133,7 @@ augroup END
let &cpo = s:save_cpo let &cpo = s:save_cpo
" ToggleSyntax {{{1 " ToggleSyntax {{{1
let g:TableModeSyntaxDict = { let g:table_mode_syntax_dict = {
\ 'contains': 'TableBorder,TableSeparator,TableColumnAlign,' . \ 'contains': 'TableBorder,TableSeparator,TableColumnAlign,' .
\ 'yesCell,noCell,maybeCell,redCell,greenCell,yellowCell,blueCell,whiteCell,darkCell', \ 'yesCell,noCell,maybeCell,redCell,greenCell,yellowCell,blueCell,whiteCell,darkCell',
\ 'containedin': 'ALL' \ 'containedin': 'ALL'