To: vim_dev@googlegroups.com Subject: Patch 8.1.0771 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.1.0771 Problem: Some shell filetype patterns end in a star. Solution: Make sure that patterns not ending in a star are preferred. Files: runtime/filetype.vim, runtime/autoload/dist/ft.vim *** ../vim-8.1.0770/runtime/filetype.vim 2018-11-03 19:52:11.333956689 +0100 --- runtime/filetype.vim 2019-01-18 21:20:27.678878376 +0100 *************** *** 1462,1470 **** " 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)) " Shell script (Arch Linux) or PHP file (Drupal) au BufNewFile,BufRead *.install --- 1462,1472 ---- " 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 .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,1488 **** \ endif " tcsh scripts ! 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() " 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 setf zsh " Scheme --- 1477,1490 ---- \ endif " tcsh scripts ! 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() " 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 setf zsh " Scheme *************** *** 2074,2079 **** --- 2076,2095 ---- " 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') *** ../vim-8.1.0770/runtime/autoload/dist/ft.vim 2017-12-05 21:37:31.000000000 +0100 --- runtime/autoload/dist/ft.vim 2019-01-18 21:19:20.775377125 +0100 *************** *** 126,132 **** " This function checks if one of the first ten lines start with a '@'. In " that case it is probably a change file. " If the first line starts with # or ! it's probably a ch file. ! " If a line has "main", "include", "//" ir "/*" it's probably ch. " Otherwise CHILL is assumed. func dist#ft#FTchange() let lnum = 1 --- 126,132 ---- " This function checks if one of the first ten lines start with a '@'. In " that case it is probably a change file. " If the first line starts with # or ! it's probably a ch file. ! " If a line has "main", "include", "//" or "/*" it's probably ch. " Otherwise CHILL is assumed. func dist#ft#FTchange() let lnum = 1 *************** *** 484,489 **** --- 484,493 ---- " Called from filetype.vim and scripts.vim. func dist#ft#SetFileTypeSH(name) + if did_filetype() + " Filetype was already detected + return + endif if expand("") =~ g:ft_ignore_pat return endif *************** *** 531,536 **** --- 535,544 ---- " as used for Tcl. " Also called from scripts.vim, thus can't be local to this script. func dist#ft#SetFileTypeShell(name) + if did_filetype() + " Filetype was already detected + return + endif if expand("") =~ g:ft_ignore_pat return endif *************** *** 551,556 **** --- 559,568 ---- endfunc func dist#ft#CSH() + if did_filetype() + " Filetype was already detected + return + endif if exists("g:filetype_csh") call dist#ft#SetFileTypeShell(g:filetype_csh) elseif &shell =~ "tcsh" *************** *** 632,638 **** " Choose context, plaintex, or tex (LaTeX) based on these rules: " 1. Check the first line of the file for "%&". " 2. Check the first 1000 non-comment lines for LaTeX or ConTeXt keywords. ! " 3. Default to "latex" or to g:tex_flavor, can be set in user's vimrc. func dist#ft#FTtex() let firstline = getline(1) if firstline =~ '^%&\s*\a\+' --- 644,650 ---- " Choose context, plaintex, or tex (LaTeX) based on these rules: " 1. Check the first line of the file for "%&". " 2. Check the first 1000 non-comment lines for LaTeX or ConTeXt keywords. ! " 3. Default to "plain" or to g:tex_flavor, can be set in user's vimrc. func dist#ft#FTtex() let firstline = getline(1) if firstline =~ '^%&\s*\a\+' *** ../vim-8.1.0770/src/version.c 2019-01-17 22:28:18.901373188 +0100 --- src/version.c 2019-01-18 21:44:39.609527401 +0100 *************** *** 793,794 **** --- 793,796 ---- { /* Add new patch number below this line */ + /**/ + 771, /**/ -- Hear about the guy who played a blank tape at full blast? The mime next door went nuts. /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///