From 59900a3feffc632f3fca3abbc64b71d14eed0687 Mon Sep 17 00:00:00 2001 From: Jonas DOREL Date: Tue, 5 Oct 2021 20:20:57 +0200 Subject: [PATCH 1/2] fix(regex): some words start with no --- autoload/tablemode.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/autoload/tablemode.vim b/autoload/tablemode.vim index b9b26df..8c7d258 100644 --- a/autoload/tablemode.vim +++ b/autoload/tablemode.vim @@ -83,7 +83,7 @@ function! s:ToggleSyntax() "{{{2 if exists("g:table_mode_color_cells") && g:table_mode_color_cells syntax match yesCell '|\@<= *yes[^|]*' contained - syntax match noCell '|\@<= *no[^|]*' contained + syntax match noCell '|\@<= *no\A[^|]*' contained " \A to exclude words like notes syntax match maybeCell '|\@<= *?[^|]*' contained " '|\@<=' : Match previous characters, excluding them from the group endif From 0fe6bd87acd207afc2ddda8269b4fefe04a1a659 Mon Sep 17 00:00:00 2001 From: Jonas DOREL Date: Thu, 7 Oct 2021 18:37:17 +0200 Subject: [PATCH 2/2] feat(highlight): add color prefixes --- autoload/tablemode.vim | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/autoload/tablemode.vim b/autoload/tablemode.vim index 8c7d258..d601634 100644 --- a/autoload/tablemode.vim +++ b/autoload/tablemode.vim @@ -71,7 +71,7 @@ function! s:ToggleSyntax() "{{{2 if tablemode#IsActive() exec 'syntax match Table' \ '/' . tablemode#table#StartExpr() . '\zs|.\+|\ze' . tablemode#table#EndExpr() . '/' - \ 'contains=TableBorder,TableSeparator,TableColumnAlign,yesCell,noCell,maybeCell' + \ 'contains=TableBorder,TableSeparator,TableColumnAlign,yesCell,noCell,maybeCell,redCell,greenCell,yellowCell,blueCell,whiteCell,darkCell' \ 'containedin=ALL' syntax match TableSeparator /|/ contained syntax match TableColumnAlign /:/ contained @@ -81,6 +81,24 @@ function! s:ToggleSyntax() "{{{2 hi! link TableSeparator Delimiter hi! link TableColumnAlign Type + syntax match redCell '|\@<= *r:[^|]*' contained + hi redCell ctermfg=9 ctermbg=1 + + syntax match greenCell '|\@<= *g:[^|]*' contained + hi greenCell ctermfg=10 ctermbg=2 + + syntax match yellowCell '|\@<= *y:[^|]*' contained + hi yellowCell ctermfg=11 ctermbg=3 + + syntax match blueCell '|\@<= *b:[^|]*' contained + hi blueCell ctermfg=12 ctermbg=4 + + syntax match whiteCell '|\@<= *w:[^|]*' contained + hi whiteCell ctermfg=0 ctermbg=15 + + syntax match darkCell '|\@<= *d:[^|]*' contained + hi darkCell ctermfg=15 ctermbg=0 + if exists("g:table_mode_color_cells") && g:table_mode_color_cells syntax match yesCell '|\@<= *yes[^|]*' contained syntax match noCell '|\@<= *no\A[^|]*' contained " \A to exclude words like notes