diff options
-rw-r--r-- | runtime/filetype.vim | 10 | ||||
-rw-r--r-- | src/nvim/testdir/test_filetype.vim | 4 |
2 files changed, 8 insertions, 6 deletions
diff --git a/runtime/filetype.vim b/runtime/filetype.vim index 52cd2dcbfd..b7157a14e7 100644 --- a/runtime/filetype.vim +++ b/runtime/filetype.vim @@ -1,7 +1,7 @@ " Vim support file to detect file types " " Maintainer: Bram Moolenaar <Bram@vim.org> -" Last Change: 2020 Apr 29 +" Last Change: 2021 Apr 05 " Listen very carefully, I will say this only once if exists("did_load_filetypes") @@ -1559,11 +1559,10 @@ au BufNewFile,BufRead catalog setf catalog " Shell scripts (sh, ksh, bash, bash2, csh); Allow .profile_foo etc. " Gentoo ebuilds and Arch Linux PKGBUILDs are actually bash scripts " NOTE: Patterns ending in a star are further down, these have lower priority. -au BufNewFile,BufRead .bashrc,bashrc,bash.bashrc,.bash[_-]profile,.bash[_-]logout,.bash[_-]aliases,bash-fc[-.],*.bash,*/{,.}bash[_-]completion{,.d,.sh}{,/*},*.ebuild,*.eclass,PKGBUILD call dist#ft#SetFileTypeSH("bash") +au BufNewFile,BufRead .bashrc,bashrc,bash.bashrc,.bash[_-]profile,.bash[_-]logout,.bash[_-]aliases,bash-fc[-.],*.ebuild,*.bash,*.eclass,PKGBUILD,APKBUILD call dist#ft#SetFileTypeSH("bash") au BufNewFile,BufRead .kshrc,*.ksh call dist#ft#SetFileTypeSH("ksh") au BufNewFile,BufRead */etc/profile,.profile,*.sh,*.env call dist#ft#SetFileTypeSH(getline(1)) - " Shell script (Arch Linux) or PHP file (Drupal) au BufNewFile,BufRead *.install \ if getline(1) =~ '<?php' | @@ -2237,8 +2236,11 @@ au BufNewFile,BufRead .reminders* call s:StarSetf('remind') " SGML catalog file au BufNewFile,BufRead sgml.catalog* call s:StarSetf('catalog') +" avoid doc files being recognized a shell files +au BufNewFile,BufRead */doc/{,.}bash[_-]completion{,.d,.sh}{,/*} setf text + " Shell scripts ending in a star -au BufNewFile,BufRead .bashrc*,.bash[_-]profile*,.bash[_-]logout*,.bash[_-]aliases*,bash-fc[-.]*,,PKGBUILD* call dist#ft#SetFileTypeSH("bash") +au BufNewFile,BufRead .bashrc*,.bash[_-]profile*,.bash[_-]logout*,.bash[_-]aliases*,bash-fc[-.]*,PKGBUILD*,APKBUILD*,*/{,.}bash[_-]completion{,.d,.sh}{,/*} call dist#ft#SetFileTypeSH("bash") au BufNewFile,BufRead .kshrc* call dist#ft#SetFileTypeSH("ksh") au BufNewFile,BufRead .profile* call dist#ft#SetFileTypeSH(getline(1)) diff --git a/src/nvim/testdir/test_filetype.vim b/src/nvim/testdir/test_filetype.vim index fa0bffd96c..1a98dc6451 100644 --- a/src/nvim/testdir/test_filetype.vim +++ b/src/nvim/testdir/test_filetype.vim @@ -417,7 +417,7 @@ let s:filename_checks = { \ 'sensors': ['/etc/sensors.conf', '/etc/sensors3.conf'], \ 'services': ['/etc/services'], \ 'setserial': ['/etc/serial.conf'], - \ 'sh': ['/etc/udev/cdsymlinks.conf'], + \ 'sh': ['.bashrc', 'file.bash', '/usr/share/doc/bash-completion/filter.sh','/etc/udev/cdsymlinks.conf', 'any/etc/udev/cdsymlinks.conf'], \ 'sieve': ['file.siv', 'file.sieve'], \ 'simula': ['file.sim'], \ 'sinda': ['file.sin', 'file.s85'], @@ -471,7 +471,7 @@ let s:filename_checks = { \ 'tex': ['file.latex', 'file.sty', 'file.dtx', 'file.ltx', 'file.bbl'], \ 'texinfo': ['file.texinfo', 'file.texi', 'file.txi'], \ 'texmf': ['texmf.cnf'], - \ 'text': ['file.text', 'README'], + \ 'text': ['file.text', 'README', '/usr/share/doc/bash-completion/AUTHORS'], \ 'tf': ['file.tf', '.tfrc', 'tfrc'], \ 'tidy': ['.tidyrc', 'tidyrc', 'tidy.conf'], \ 'tilde': ['file.t.html'], |