0
0
mirror of https://github.com/vim/vim.git synced 2025-09-23 03:43:49 -04:00

patch 9.1.1307: make syntax does not reliably detect different flavors

Problem:  GNU extensions, such as `ifeq` and `wildcard` function, are
          highlighted in BSDmakefile
Solution: detect BSD, GNU, or Microsoft implementation according to
	  filename, user-defined global variables, or file contents

closes: #17089

Co-authored-by: Roland Hieber <rohieb@users.noreply.github.com>
Signed-off-by: Eisuke Kawashima <e-kwsm@users.noreply.github.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
Eisuke Kawashima
2025-04-15 19:20:06 +02:00
committed by Christian Brabandt
parent 32f2bb6e1e
commit f35bd76b31
7 changed files with 126 additions and 28 deletions

View File

@@ -1,4 +1,4 @@
*filetype.txt* For Vim version 9.1. Last change: 2025 Mar 15
*filetype.txt* For Vim version 9.1. Last change: 2025 Apr 15
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -158,6 +158,8 @@ variables can be used to overrule the filetype used for certain extensions:
*.inc g:filetype_inc
*.lsl g:filetype_lsl
*.m g:filetype_m |ft-mathematica-syntax|
*[mM]makefile,*.mk,*.mak,[mM]akefile*
g:make_flavor |ft-make-syntax|
*.markdown,*.mdown,*.mkd,*.mkdn,*.mdwn,*.md
g:filetype_md |ft-pandoc-syntax|
*.mod g:filetype_mod

View File

@@ -1,4 +1,4 @@
*syntax.txt* For Vim version 9.1. Last change: 2025 Apr 13
*syntax.txt* For Vim version 9.1. Last change: 2025 Apr 15
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -2393,11 +2393,16 @@ Comments are also highlighted by default. You can turn this off by using: >
:let make_no_comments = 1
Microsoft Makefile handles variable expansion and comments differently
(backslashes are not used for escape). If you see any wrong highlights
because of this, you can try this: >
There are various Make implementations, which add extensions other than the
POSIX specification and thus are mutually incompatible. If the filename is
BSDmakefile or GNUmakefile, the corresponding implementation is automatically
determined; otherwise vim tries to detect it by the file contents. If you see
any wrong highlights because of this, you can enforce a flavor by setting one
of the following: >
:let make_microsoft = 1
:let g:make_flavor = 'bsd' " or
:let g:make_flavor = 'gnu' " or
:let g:make_flavor = 'microsoft'
MAPLE *maple.vim* *ft-maple-syntax*