diff runtime/autoload/dist/ft.vim @ 29659:2198955f9e27

Update runtime files Commit: https://github.com/vim/vim/commit/48c3f4e0bff7efd289a7001b68c777b6f89a7057 Author: Bram Moolenaar <Bram@vim.org> Date: Mon Aug 8 15:42:38 2022 +0100 Update runtime files
author Bram Moolenaar <Bram@vim.org>
date Mon, 08 Aug 2022 16:45:05 +0200
parents 6c1e06abff2c
children 87063bfe81cd
line wrap: on
line diff
--- a/runtime/autoload/dist/ft.vim
+++ b/runtime/autoload/dist/ft.vim
@@ -348,7 +348,7 @@ export def FTidl()
   setf idl
 enddef
 
-# Distinguish between "default" and Cproto prototype file. */
+# Distinguish between "default", Prolog and Cproto prototype file.
 export def ProtoCheck(default: string)
   # Cproto files have a comment in the first line and a function prototype in
   # the second line, it always ends in ";".  Indent files may also have
@@ -358,7 +358,14 @@ export def ProtoCheck(default: string)
   if getline(2) =~ '.;$'
     setf cpp
   else
-    exe 'setf ' .. default
+    # recognize Prolog by specific text in the first non-empty line
+    # require a blank after the '%' because Perl uses "%list" and "%translate"
+    var l = getline(nextnonblank(1))
+    if l =~ '\<prolog\>' || l =~ '^\s*\(%\+\(\s\|$\)\|/\*\)' || l =~ ':-'
+      setf prolog
+    else
+      exe 'setf ' .. default
+    endif
   endif
 enddef