nano/syntax/makefile.nanorc
Benno Schulenberg c02aec557c syntax: makefile, sh: recognize also a fresh Makefile and fresh .profile
When opening a nonexistent file with nano, it likely consists of only a
name without any path component, and thus without any slash.  So when a
file regex checks for a slash, it should check also for start-of-string.

This fixes https://savannah.gnu.org/bugs/?65591.

Problem existed for the Makefile since version 2.9.8, commit 22663f8a,
and for .profile since version 3.0, commit 4a268678 (but earlier, nano
did not recognize .profile files at all).
2024-04-14 12:09:36 +02:00

27 lines
552 B
Plaintext

## Syntax highlighting for Makefiles.
syntax makefile "(^|/)((GNU)?m|M)akefile[^/]*$|\.(make|mk)$"
magic "makefile script"
tabgives " "
comment "#"
# Assignments.
color red " (:?:|\+|\?)?= "
# Keywords.
color magenta "^(if|ifn?def|ifn?eq|else|endif|(-|s)?include)\>"
color magenta "^((override +)?(un)?define|endef|(un)?export|private|vpath)\>"
# Variable expansions.
color blue "\$+[{(][a-zA-Z0-9_-]+[})]"
# Targets.
color brightblue "^[^ ]+:"
# Comments.
color green "(^|[[:blank:]]+)#.*"
# Trailing whitespace.
color ,green "[[:space:]]+$"