]> granicus.if.org Git - vim/commitdiff
patch 9.0.0935: when using dash it may not be recognize as filetype "sh" v9.0.0935
authorEisuke Kawashima <e-kwsm@users.noreply.github.com>
Thu, 24 Nov 2022 10:58:10 +0000 (10:58 +0000)
committerBram Moolenaar <Bram@vim.org>
Thu, 24 Nov 2022 10:58:10 +0000 (10:58 +0000)
Problem:    When using dash it may not be recognize as filetype "sh".
Solution:   Add checks for "dash". (Eisuke Kawashima,closes #11600)

runtime/autoload/dist/ft.vim
runtime/autoload/dist/script.vim
src/testdir/test_filetype.vim
src/version.c

index 8f744457caf90b5c200996662b881fa4777a87c8..c40e0c84d55acf916e39c2e54f24aec5568d5dec 100644 (file)
@@ -712,7 +712,8 @@ export def SetFileTypeSH(name: string)
     if exists("b:is_sh")
       unlet b:is_sh
     endif
-  elseif name =~ '\<sh\>'
+  elseif name =~ '\<sh\>' || name =~ '\<dash\>'
+    # Ubuntu links "sh" to "dash", thus it is expected to work the same way
     b:is_sh = 1
     if exists("b:is_kornshell")
       unlet b:is_kornshell
index 9e419697774e9e6f1e0832a1b746e562444713b2..8c5441cc820ae4d4e536882203e605a8f1619b61 100644 (file)
@@ -53,8 +53,8 @@ def DetectFromHashBang(firstline: string)
     name = 'wish'
   endif
 
-  # Bourne-like shell scripts: bash bash2 ksh ksh93 sh
-  if name =~ '^\(bash\d*\|\|ksh\d*\|sh\)\>'
+    # Bourne-like shell scripts: bash bash2 dash ksh ksh93 sh
+  if name =~ '^\(bash\d*\|dash\|ksh\d*\|sh\)\>'
     call dist#ft#SetFileTypeSH(line1)
 
     # csh scripts
index c7c494aaa5eeb2bbe45079c859ef413e06ce5329..765ee892071286312f73b81f6c5c2b4b32fdedbe 100644 (file)
@@ -704,6 +704,13 @@ let s:script_checks = {
       \                ['__libc_start_main and something']],
       \ 'clojure': [['#!/path/clojure']],
       \ 'scala': [['#!/path/scala']],
+      \ 'sh':  [['#!/path/sh'],
+      \         ['#!/path/bash'],
+      \         ['#!/path/bash2'],
+      \         ['#!/path/dash'],
+      \         ['#!/path/ksh'],
+      \         ['#!/path/ksh93']],
+      \ 'csh': [['#!/path/csh']],
       \ 'tcsh': [['#!/path/tcsh']],
       \ 'zsh': [['#!/path/zsh']],
       \ 'tcl': [['#!/path/tclsh'],
index 55f363fb183d7c417d978b9342ddf2f86252c5a1..42a7e46b6c5b9dfa0ecc77e230c9f457b78adf2f 100644 (file)
@@ -695,6 +695,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    935,
 /**/
     934,
 /**/