patch 9.1.0616: filetype: Make syntax highlighting off for MS Makefiles
Problem: filetype: Make syntax highlighting off for MS Makefiles
Solution: Try to detect MS Makefiles and adjust syntax rules to it.
(Ken Takata)
Highlighting of variable expansion in Microsoft Makefile can be broken.
E.g.:
2979cfc262/src/Make_mvc.mak (L1331)
Don't use backslash as escape characters if `make_microsoft` is set.
Also fix that `make_no_comments` was not considered if `make_microsoft`
was set.
Also add description for `make_microsoft` and `make_no_comments` to the
documentation and include a very simple filetype test
closes: #15341
Signed-off-by: Christian Brabandt <cb@256bit.org>
Signed-off-by: Ken Takata <kentkt@csc.jp>
This commit is contained in:
committed by
Christian Brabandt
parent
242667ae14
commit
eb4b903c9b
19
runtime/autoload/dist/ft.vim
vendored
19
runtime/autoload/dist/ft.vim
vendored
@ -532,6 +532,25 @@ export def FTm()
|
||||
endif
|
||||
enddef
|
||||
|
||||
export def FTmake()
|
||||
# Check if it is a Microsoft Makefile
|
||||
unlet! b:make_microsoft
|
||||
var n = 1
|
||||
while n < 1000 && n <= line('$')
|
||||
var line = getline(n)
|
||||
if line =~? '^\s*!\s*\(ifn\=\(def\)\=\|include\|message\|error\)\>'
|
||||
b:make_microsoft = 1
|
||||
break
|
||||
elseif line =~ '^ *ifn\=\(eq\|def\)\>' || line =~ '^ *[-s]\=include\s'
|
||||
break
|
||||
elseif line =~ '^ *\w\+\s*[!?:+]='
|
||||
break
|
||||
endif
|
||||
n += 1
|
||||
endwhile
|
||||
setf make
|
||||
enddef
|
||||
|
||||
export def FTmms()
|
||||
var n = 1
|
||||
while n < 20
|
||||
|
||||
Reference in New Issue
Block a user