Hello list,

the attached patch addresses 2 issues regarding comments in Makefiles:

1) a comment in a rule is not highlighted, e.g.:

target1: # comment1

here, comment1 is not highlighted.

2) (Makefile-) comments in repipes destroy the highlighting of the
        recipe, e.g:

target2:
        command1
# comment2
        command2

here, command1 is highlighted while command2 is not.

This is my first time hacking vim scripts. I don't even know
if it has the correct syntax and style. Feel free to correct me.

The patch applies to the file runtime/syntax/make.vim in the
default brach of the hg repository.

Regards,
Matthias

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.
--- a/make.vim	2013-02-10 03:28:50.000000000 +0100
+++ b/make.vim	2014-07-22 13:40:22.205835722 +0200
@@ -55,8 +55,8 @@
 syn match makeImplicit		"^\.[A-Za-z0-9_./\t -]\+\s*:$"me=e-1 nextgroup=makeSource
 syn match makeImplicit		"^\.[A-Za-z0-9_./\t -]\+\s*:[^=]"me=e-2 nextgroup=makeSource
 
-syn region makeTarget	transparent matchgroup=makeTarget start="^[A-Za-z0-9_./$()%-][A-Za-z0-9_./\t $()%-]*:\{1,2}[^:=]"rs=e-1 end=";"re=e-1,me=e-1 end="[^\\]$" keepend contains=makeIdent,makeSpecTarget,makeNextLine skipnl nextGroup=makeCommands
-syn match makeTarget		"^[A-Za-z0-9_./$()%*@-][A-Za-z0-9_./\t $()%*@-]*::\=\s*$" contains=makeIdent,makeSpecTarget skipnl nextgroup=makeCommands,makeCommandError
+syn region makeTarget	transparent matchgroup=makeTarget start="^[A-Za-z0-9_./$()%-][A-Za-z0-9_./\t $()%-]*:\{1,2}[^:=]"rs=e-1 end=";"re=e-1,me=e-1 end="[^\\]$" keepend contains=makeIdent,makeSpecTarget,makeNextLine,makeComment skipnl nextGroup=makeCommands,makeCommentAfterTarget
+syn match makeTarget		"^[A-Za-z0-9_./$()%*@-][A-Za-z0-9_./\t $()%*@-]*::\=\s*$" contains=makeIdent,makeSpecTarget,makeComment skipnl nextgroup=makeCommands,makeCommandError,makeCommentAfterTarget
 
 syn region makeSpecTarget	transparent matchgroup=makeSpecTarget start="^\.\(SUFFIXES\|PHONY\|DEFAULT\|PRECIOUS\|IGNORE\|SILENT\|EXPORT_ALL_VARIABLES\|KEEP_STATE\|LIBPATTERNS\|NOTPARALLEL\|DELETE_ON_ERROR\|INTERMEDIATE\|POSIX\|SECONDARY\)\>\s*:\{1,2}[^:=]"rs=e-1 end="[^\\]$" keepend contains=makeIdent,makeSpecTarget,makeNextLine skipnl nextGroup=makeCommands
 syn match makeSpecTarget		"^\.\(SUFFIXES\|PHONY\|DEFAULT\|PRECIOUS\|IGNORE\|SILENT\|EXPORT_ALL_VARIABLES\|KEEP_STATE\|LIBPATTERNS\|NOTPARALLEL\|DELETE_ON_ERROR\|INTERMEDIATE\|POSIX\|SECONDARY\)\>\s*::\=\s*$" contains=makeIdent skipnl nextgroup=makeCommands,makeCommandError
@@ -73,6 +73,8 @@
 if exists("make_microsoft")
    syn match  makeComment "#.*" contains=@Spell,makeTodo
 elseif !exists("make_no_comments")
+   syn region  makeCommentAfterTarget	start="#" end="^$" end="[^\\]$" keepend contains=@Spell,makeTodo skipnl nextGroup=makeCommands,makeCommentAfterTarget contained
+   syn match   makeCommentAfterTarget	"#$" contains=@Spell contained
    syn region  makeComment	start="#" end="^$" end="[^\\]$" keepend contains=@Spell,makeTodo
    syn match   makeComment	"#$" contains=@Spell
 endif
@@ -113,6 +115,7 @@
 
   HiLink makeNextLine		makeSpecial
   HiLink makeCmdNextLine	makeSpecial
+  HiLink makeCommentAfterTarget	makeComment
   HiLink makeSpecTarget		Statement
   if !exists("make_no_commands")
     HiLink makeCommands		Number

Raspunde prin e-mail lui