Patch 9.0.1620
Problem:    Nix files are not recognized from the hashbang line.
Solution:   Add a hashbang check. (issue #12507)
Files:      runtime/autoload/dist/script.vim, src/testdir/test_filetype.vim


*** ../vim-9.0.1619/runtime/autoload/dist/script.vim    2023-05-06 
21:21:48.400778151 +0100
--- runtime/autoload/dist/script.vim    2023-06-08 21:20:35.192369941 +0100
***************
*** 4,10 ****
  # Invoked from "scripts.vim" in 'runtimepath'
  #
  # Maintainer: Bram Moolenaar <b...@vim.org>
! # Last Change:        2022 Feb 13
  
  export def DetectFiletype()
    var line1 = getline(1)
--- 4,10 ----
  # Invoked from "scripts.vim" in 'runtimepath'
  #
  # Maintainer: Bram Moolenaar <b...@vim.org>
! # Last Change:        2023 Jun 08
  
  export def DetectFiletype()
    var line1 = getline(1)
***************
*** 44,50 ****
    elseif line1 =~ '^#!\s*[^/\\ ]*\>\([^/\\]\|$\)'
      name = substitute(line1, '^#!\s*\([^/\\ ]*\>\).*', '\1', '')
    else
!     name = substitute(line1, '^#!\s*\S*[/\\]\(\i\+\).*', '\1', '')
    endif
  
    # tcl scripts may have #!/bin/sh in the first line and "exec wish" in the
--- 44,50 ----
    elseif line1 =~ '^#!\s*[^/\\ ]*\>\([^/\\]\|$\)'
      name = substitute(line1, '^#!\s*\([^/\\ ]*\>\).*', '\1', '')
    else
!     name = substitute(line1, '^#!\s*\S*[/\\]\(\f\+\).*', '\1', '')
    endif
  
    # tcl scripts may have #!/bin/sh in the first line and "exec wish" in the
***************
*** 197,202 ****
--- 197,206 ----
    elseif name =~ 'guile'
      setl ft=scheme
  
+     # Nix
+   elseif name =~ 'nix-shell'
+     setl ft=nix
+ 
    endif
  enddef
  
*** ../vim-9.0.1619/src/testdir/test_filetype.vim       2023-06-08 
17:57:15.121742166 +0100
--- src/testdir/test_filetype.vim       2023-06-08 19:53:00.474048870 +0100
***************
*** 852,857 ****
--- 852,858 ----
      expect: [['#!/path/expect']],
      gnuplot: [['#!/path/gnuplot']],
      make:   [['#!/path/make']],
+     nix:    [['#!/path/nix-shell']],
      pike:   [['#!/path/pike'],
              ['#!/path/pike0'],
              ['#!/path/pike9']],
***************
*** 902,907 ****
--- 903,909 ----
      scheme: [['#!/usr/bin/env VAR=val --ignore-environment scheme']],
      python: [['#!/usr/bin/env VAR=val -S python -w -T']],
      wml: [['#!/usr/bin/env VAR=val --split-string wml']],
+     nix: [['#!/usr/bin/env nix-shell']],
    }
  enddef
  
*** ../vim-9.0.1619/src/version.c       2023-06-08 18:43:55.771781364 +0100
--- src/version.c       2023-06-08 19:39:04.062799054 +0100
***************
*** 697,698 ****
--- 697,700 ----
  {   /* Add new patch number below this line */
+ /**/
+     1620,
  /**/

-- 
hundred-and-one symptoms of being an internet addict:
136. You decide to stay in a low-paying job teaching just for the
     free Internet access.

 /// Bram Moolenaar -- b...@moolenaar.net -- http://www.Moolenaar.net   \\\
///                                                                      \\\
\\\        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/20230608202745.992FD1C0642%40moolenaar.net.

Reply via email to