]> granicus.if.org Git - vim/commitdiff
patch 8.2.4095: sed script not recognized by the first line v8.2.4095
authorBram Moolenaar <Bram@vim.org>
Sat, 15 Jan 2022 12:27:09 +0000 (12:27 +0000)
committerBram Moolenaar <Bram@vim.org>
Sat, 15 Jan 2022 12:27:09 +0000 (12:27 +0000)
Problem:    Sed script not recognized by the first line.
Solution:   Recognize a sed script starting with "#n". (Doug Kearns)

runtime/scripts.vim
src/testdir/test_filetype.vim
src/version.c

index e41405a6c54abe59ada42642501910258a623681..dd47f65ba003186892dfc179e56b7c270c7aa8ac 100644 (file)
@@ -406,6 +406,12 @@ else
   elseif s:line1 =~# '^#.*by RouterOS.*$'
     set ft=routeros
 
+  " Sed scripts
+  " #ncomment is allowed but most likely a false positive so require a space
+  " before any trailing comment text
+  elseif s:line1 =~# '^#n\%($\|\s\)'
+    set ft=sed
+
   " CVS diff
   else
     let s:lnum = 1
index 5a5ba5f11c55dd129f998495e145214e11b1c33b..755eafcd224b20e955626230e011e1f3cf228df5 100644 (file)
@@ -654,7 +654,7 @@ let s:script_checks = {
       \                ['#!/path/nodejs'],
       \                ['#!/path/rhino']],
       \ 'bc': [['#!/path/bc']],
-      \ 'sed': [['#!/path/sed']],
+      \ 'sed': [['#!/path/sed'], ['#n'], ['#n comment']],
       \ 'ocaml': [['#!/path/ocaml']],
       \ 'awk': [['#!/path/awk'],
       \         ['#!/path/gawk']],
index e62c69dfce9f3b6d9a9b44f683440020f83c1e29..733021bbabd53a608dc951a54debcf3d19bf652b 100644 (file)
@@ -750,6 +750,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    4095,
 /**/
     4094,
 /**/