From 4849640ef17f32be674c8c61b1ea40e858b860a8 Mon Sep 17 00:00:00 2001 From: Balakrishnan Balasubramanian Date: Thu, 27 Oct 2022 11:05:01 -0400 Subject: [PATCH] handle inline scripts better --- ftplugin/logrotate.vim | 2 +- syntax/logrotate.vim | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/ftplugin/logrotate.vim b/ftplugin/logrotate.vim index 899e3a6..e197b4d 100644 --- a/ftplugin/logrotate.vim +++ b/ftplugin/logrotate.vim @@ -13,7 +13,7 @@ def LogrotateHelp(msg: string = expand("")) gawk '/^CONFIGURATION FILE DIRECTIVES/,/^SCRIPTS/' | gawk ' /^ {7}%s/,/^[a-z]/ { if(firstLineDone) { - if(/^ {7}[^ ]/ || /^[A-Z]/) + if(/^ {0,7}[^ ]/ && !/endscript/) exit } firstLineDone = 1 diff --git a/syntax/logrotate.vim b/syntax/logrotate.vim index ad2950d..6be84ba 100644 --- a/syntax/logrotate.vim +++ b/syntax/logrotate.vim @@ -6,6 +6,12 @@ if exists("b:current_syntax") finish endif +syn region logRotateScript matchgroup=logRotateKeyword start="\s*\" end="\" contains=NONE +syn region logRotateScript matchgroup=logRotateKeyword start="\s*\" end="\" contains=NONE +syn region logRotateScript matchgroup=logRotateKeyword start="\s*\" end="\" contains=NONE +syn region logRotateScript matchgroup=logRotateKeyword start="\s*\" end="\" contains=NONE +syn region logRotateScript matchgroup=logRotateKeyword start="\s*\" end="\" contains=NONE + runtime! syntax/conf.vim " syn keyword logRotateTodo contained TODO FIXME XXX @@ -34,4 +40,6 @@ hi def link logRotateKeyword Keyword " hi def link logRotateComment Comment " hi def link logRotateTodo Todo +hi def link logRotateScript Function + let b:current_syntax = 'logrotate'