diff options
-rw-r--r-- | runtime/lua/vim/filetype/detect.lua | 1 | ||||
-rw-r--r-- | test/functional/lua/filetype_spec.lua | 2 | ||||
-rw-r--r-- | test/old/testdir/test_filetype.vim | 16 |
3 files changed, 11 insertions, 8 deletions
diff --git a/runtime/lua/vim/filetype/detect.lua b/runtime/lua/vim/filetype/detect.lua index 4f2fef5b1f..0d9c1ebc2b 100644 --- a/runtime/lua/vim/filetype/detect.lua +++ b/runtime/lua/vim/filetype/detect.lua @@ -1494,6 +1494,7 @@ local function sh(path, contents, name) vim.b[b].is_kornshell = nil vim.b[b].is_sh = nil end + return M.shell(path, contents, 'bash'), on_detect -- Ubuntu links sh to dash elseif matchregex(name, [[\<\(sh\|dash\)\>]]) then on_detect = function(b) diff --git a/test/functional/lua/filetype_spec.lua b/test/functional/lua/filetype_spec.lua index b75ff75b05..d64c024d7f 100644 --- a/test/functional/lua/filetype_spec.lua +++ b/test/functional/lua/filetype_spec.lua @@ -119,7 +119,7 @@ describe('vim.filetype', function() it('works with contents #22180', function() eq( - 'sh', + 'bash', exec_lua(function() -- Needs to be set so detect#sh doesn't fail vim.g.ft_ignore_pat = '\\.\\(Z\\|gz\\|bz2\\|zip\\|tgz\\)$' diff --git a/test/old/testdir/test_filetype.vim b/test/old/testdir/test_filetype.vim index 94bf208b67..d61c0d380d 100644 --- a/test/old/testdir/test_filetype.vim +++ b/test/old/testdir/test_filetype.vim @@ -128,6 +128,9 @@ func s:GetFilenameChecks() abort \ 'ave': ['file.ave'], \ 'awk': ['file.awk', 'file.gawk'], \ 'b': ['file.mch', 'file.ref', 'file.imp'], + \ 'bash': ['.bashrc', '.bash_profile', '.bash-profile', '.bash_logout', '.bash-logout', '.bash_aliases', + \ '.bash-aliases', '.bash_history', '.bash-history', '/tmp/bash-fc-3Ozjlw', '/tmp/bash-fc.3Ozjlw', + \ 'PKGBUILD', 'file.bash', 'file.bats', 'file.cygport'], \ 'basic': ['file.bas', 'file.bi', 'file.bm'], \ 'bass': ['file.bass'], \ 'bc': ['file.bc'], @@ -682,11 +685,10 @@ func s:GetFilenameChecks() abort \ 'services': ['/etc/services', 'any/etc/services'], \ 'setserial': ['/etc/serial.conf', 'any/etc/serial.conf'], \ 'sexplib': ['file.sexp'], - \ 'sh': ['.bashrc', '.bash_profile', '.bash-profile', '.bash_logout', '.bash-logout', '.bash_aliases', '.bash-aliases', '.bash_history', '.bash-history', - \ '/tmp/bash-fc-3Ozjlw', '/tmp/bash-fc.3Ozjlw', 'PKGBUILD', 'file.bash', '/usr/share/doc/bash-completion/filter.sh', - \ '/etc/udev/cdsymlinks.conf', 'any/etc/udev/cdsymlinks.conf', 'file.bats', '.ash_history', 'any/etc/neofetch/config.conf', '.xprofile', - \ 'user-dirs.defaults', 'user-dirs.dirs', 'makepkg.conf', '.makepkg.conf', 'file.mdd', 'file.cygport', '.env', '.envrc', 'devscripts.conf', - \ '.devscripts', 'file.lo', 'file.la', 'file.lai'], + \ 'sh': ['/usr/share/doc/bash-completion/filter.sh', '/etc/udev/cdsymlinks.conf', 'any/etc/udev/cdsymlinks.conf', + \ '.ash_history', 'any/etc/neofetch/config.conf', '.xprofile', 'user-dirs.defaults', 'user-dirs.dirs', + \ 'makepkg.conf', '.makepkg.conf', 'file.mdd', '.env', '.envrc', 'devscripts.conf', '.devscripts', 'file.lo', + \ 'file.la', 'file.lai'], \ 'sieve': ['file.siv', 'file.sieve'], \ 'sil': ['file.sil'], \ 'simula': ['file.sim'], @@ -980,11 +982,11 @@ func s:GetScriptChecks() abort \ 'clojure': [['#!/path/clojure']], \ 'scala': [['#!/path/scala']], \ 'sh': [['#!/path/sh'], - \ ['#!/path/bash'], - \ ['#!/path/bash2'], \ ['#!/path/dash'], \ ['#!/path/ksh'], \ ['#!/path/ksh93']], + \ 'bash': [['#!/path/bash'], + \ ['#!/path/bash2']], \ 'csh': [['#!/path/csh']], \ 'tcsh': [['#!/path/tcsh']], \ 'zsh': [['#!/path/zsh']], |