Mercurial > vim
diff runtime/filetype.vim @ 15527:963dd629d19a v8.1.0771
patch 8.1.0771: some shell filetype patterns end in a star
commit https://github.com/vim/vim/commit/147e7d0caba8b66ff11622e514142bcc3d24403a
Author: Bram Moolenaar <Bram@vim.org>
Date: Fri Jan 18 21:46:47 2019 +0100
patch 8.1.0771: some shell filetype patterns end in a star
Problem: Some shell filetype patterns end in a star.
Solution: Make sure that patterns not ending in a star are preferred.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Fri, 18 Jan 2019 22:00:06 +0100 |
parents | ebabd6fe3833 |
children | 45a159f62dd0 |
line wrap: on
line diff
--- a/runtime/filetype.vim +++ b/runtime/filetype.vim @@ -1462,9 +1462,11 @@ au BufNewFile,BufRead sgml.catalog* cal " Shell scripts (sh, ksh, bash, bash2, csh); Allow .profile_foo etc. " Gentoo ebuilds and Arch Linux PKGBUILDs are actually bash scripts -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 .kshrc*,*.ksh call dist#ft#SetFileTypeSH("ksh") -au BufNewFile,BufRead */etc/profile,.profile*,*.sh,*.env call dist#ft#SetFileTypeSH(getline(1)) +" 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 .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 @@ -1475,14 +1477,14 @@ au BufNewFile,BufRead *.install \ endif " tcsh scripts -au BufNewFile,BufRead .tcshrc*,*.tcsh,tcsh.tcshrc,tcsh.login call dist#ft#SetFileTypeShell("tcsh") +au BufNewFile,BufRead .tcshrc,*.tcsh,tcsh.tcshrc,tcsh.login call dist#ft#SetFileTypeShell("tcsh") " csh scripts, but might also be tcsh scripts (on some systems csh is tcsh) -au BufNewFile,BufRead .login*,.cshrc*,csh.cshrc,csh.login,csh.logout,*.csh,.alias call dist#ft#CSH() +au BufNewFile,BufRead .login,.cshrc,csh.cshrc,csh.login,csh.logout,*.csh,.alias call dist#ft#CSH() " Z-Shell script au BufNewFile,BufRead .zprofile,*/etc/zprofile,.zfbfmarks setf zsh -au BufNewFile,BufRead .zsh*,.zlog*,.zcompdump* call s:StarSetf('zsh') +au BufNewFile,BufRead .zsh,.zlog,.zcompdump call s:StarSetf('zsh') au BufNewFile,BufRead *.zsh setf zsh " Scheme @@ -2074,6 +2076,20 @@ au BufRead,BufNewFile *.rdf call dist# " Remind au BufNewFile,BufRead .reminders* call s:StarSetf('remind') +" 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 .kshrc* call dist#ft#SetFileTypeSH("ksh") +au BufNewFile,BufRead .profile* call dist#ft#SetFileTypeSH(getline(1)) + +" tcsh scripts ending in a star +au BufNewFile,BufRead .tcshrc* call dist#ft#SetFileTypeShell("tcsh") + +" csh scripts ending in a star +au BufNewFile,BufRead .login*,.cshrc* call dist#ft#CSH() + +" Z-Shell script ending in a star +au BufNewFile,BufRead .zsh*,.zlog*,.zcompdump* call s:StarSetf('zsh') + " Vim script au BufNewFile,BufRead *vimrc* call s:StarSetf('vim')