From c794f186c0a618d2d4cdd5445d9ff20e6f640762 Mon Sep 17 00:00:00 2001 From: Adam Stankiewicz Date: Thu, 8 Jul 2021 11:54:15 +0200 Subject: Update --- syntax/csv.vim | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'syntax/csv.vim') diff --git a/syntax/csv.vim b/syntax/csv.vim index ed045c7f..0e1d3a02 100644 --- a/syntax/csv.vim +++ b/syntax/csv.vim @@ -55,6 +55,12 @@ fu! CheckSaneSearchPattern() "{{{3 let b:csv_cmt = [g:csv_comment] endif + " Make sure, b:csv_cmt always has 2 items + " can happen with e.g. :set cms="#%s + if b:csv_cmt == [] + let b:csv_cmt = ['', ''] + endif + " Second: Check for sane defaults for the column pattern " Not necessary to check for fixed width columns @@ -131,9 +137,11 @@ fu! DoHighlight() "{{{3 endfor endif " Comment regions - exe 'syn match CSVComment /'. s:cmts. '.*'. - \ (!empty(s:cmte) ? '\%('. s:cmte. '\)\?' - \: ''). '/' + if !empty(s:cmts) + exe 'syn match CSVComment /'. s:cmts. '.*'. + \ (!empty(s:cmte) ? '\%('. s:cmte. '\)\?' + \: ''). '/' + endif hi def link CSVComment Comment endfun -- cgit v1.2.3