X-Git-Url: https://jasonwoof.com/gitweb/?p=vim-syntax.git;a=blobdiff_plain;f=csv.vim;h=04efc7061b0453162fa441f3cbe0350b2e276561;hp=baa0ea25a4499fa82d95fdd6fa67cac4c6691435;hb=3ad9d2746ac85bd4b0015f795b195358c37fb6ca;hpb=e22e5cbb1d8c6d90f4bbec27eeb15550c87bf6dd 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