From 3ad9d2746ac85bd4b0015f795b195358c37fb6ca Mon Sep 17 00:00:00 2001 From: Jason Woofenden Date: Sat, 14 Dec 2013 22:50:13 -0500 Subject: [PATCH] coffee: more lookback, csv: quoted fields --- coffee.vim | 2 +- csv.vim | 26 ++++++++++++++++++++------ 2 files changed, 21 insertions(+), 7 deletions(-) diff --git a/coffee.vim b/coffee.vim index 1ab0421..0840954 100644 --- a/coffee.vim +++ b/coffee.vim @@ -15,7 +15,7 @@ endif syn include @coffeeJS syntax/javascript.vim " Highlight long strings. -syn sync minlines=100 +syn sync minlines=2000 " CoffeeScript allows dollar signs in identifiers. setlocal isident+=$ diff --git a/csv.vim b/csv.vim index baa0ea2..04efc70 100644 --- a/csv.vim +++ b/csv.vim @@ -4,10 +4,24 @@ highlight csv3 ctermfg=blue highlight csv4 ctermfg=yellow highlight csv5 ctermfg=cyan highlight csv6 ctermfg=white +highlight quoted1 ctermfg=darkred +highlight quoted2 ctermfg=green +highlight quoted3 ctermfg=blue +highlight quoted4 ctermfg=yellow +highlight quoted5 ctermfg=cyan +highlight quoted6 ctermfg=white + +syn region quoted1 start="\"" end="\"" contained +syn region quoted2 start="\"" end="\"" contained +syn region quoted3 start="\"" end="\"" contained +syn region quoted4 start="\"" end="\"" contained +syn region quoted5 start="\"" end="\"" contained +syn region quoted6 start="\"" end="\"" contained + +syn match csv1 /^[^,]*/ contains=quoted1 nextgroup=csv2 +syn match csv2 /,[^,]*/hs=s+1 contained contains=quoted2 nextgroup=csv3 +syn match csv3 /,[^,]*/hs=s+1 contained contains=quoted3 nextgroup=csv4 +syn match csv4 /,[^,]*/hs=s+1 contained contains=quoted4 nextgroup=csv5 +syn match csv5 /,[^,]*/hs=s+1 contained contains=quoted5 nextgroup=csv6 +syn match csv6 /,[^,]*/hs=s+1 contained contains=quoted6 nextgroup=csv2 -syn match csv1 /^[^,]*/ nextgroup=csv2 -syn match csv2 /,[^,]*/hs=s+1 contained nextgroup=csv3 -syn match csv3 /,[^,]*/hs=s+1 contained nextgroup=csv4 -syn match csv4 /,[^,]*/hs=s+1 contained nextgroup=csv5 -syn match csv5 /,[^,]*/hs=s+1 contained nextgroup=csv6 -syn match csv6 /,[^,]*/hs=s+1 contained nextgroup=csv2 -- 1.7.10.4