changeset 27132:0b5ce27d8b68 v8.2.4095

patch 8.2.4095: sed script not recognized by the first line Commit: https://github.com/vim/vim/commit/e3ce17a3ca838954728df21ccb6c2a724490203d Author: Bram Moolenaar <Bram@vim.org> Date: Sat Jan 15 12:27:09 2022 +0000 patch 8.2.4095: sed script not recognized by the first line Problem: Sed script not recognized by the first line. Solution: Recognize a sed script starting with "#n". (Doug Kearns)
author Bram Moolenaar <Bram@vim.org>
date Sat, 15 Jan 2022 13:30:03 +0100
parents 548a6a5417c8
children 939b925908b1
files runtime/scripts.vim src/testdir/test_filetype.vim src/version.c
diffstat 3 files changed, 9 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/runtime/scripts.vim
+++ b/runtime/scripts.vim
@@ -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
--- a/src/testdir/test_filetype.vim
+++ b/src/testdir/test_filetype.vim
@@ -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']],
--- a/src/version.c
+++ b/src/version.c
@@ -751,6 +751,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    4095,
+/**/
     4094,
 /**/
     4093,